Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIR-V] Correct/improve declaration of some SPIR-V builtins #1519

Merged

Conversation

Naghasan
Copy link
Contributor

Make the address space overloads more flexible by supporting OpenCL and SYCL.

Correct the signature of _spirv_ocl_native* and _spirv_ocl_half* builtins.
Correct the naming of overloads of __spirv_ocl_vload* and __spirv_ocl_vstore* builtins.
Add missing overloads for conversion with specific rounding modes and saturation.
Remove inexistent __spirv_All(bool) and __spirv_Any(bool) overloads.

Signed-off-by: Victor Lomuller victor@codeplay.com

@Naghasan
Copy link
Contributor Author

Some of the changes are also in PR (some rounding modes) #1463, will remove the WIP once it is merged

@@ -86,6 +86,24 @@ inline bool isPtrSizeAddressSpace(LangAS AS) {
AS == LangAS::ptr64);
}

/// Convert an OpenCL lang address space into a SYCL one.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need it?
BTW, I think we should use OpenCL address spaces "as is" instead of doing some stuff with SYCL address spaces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there was a significant effort as I recall to remove this, @bader ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, here it is #1039 . The only problem is failing C++ for OpenCL test but it is because of bug in C++ for OpenCL (I debugged it and described it in comments for PR 1039).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I think we should use OpenCL address spaces "as is" instead of doing some stuff with SYCL address spaces.

I totally agree with you, I don't see any rational to have this distinction.

The problem is that this patch is not merge, so for the moment opencl_global != sycl_global. This means a pointer to opencl_global is different to a pointer sycl_global.

@Naghasan Naghasan force-pushed the victor/spirv-fix-builtin-decls branch 2 times, most recently from e3e97b8 to e5d0def Compare April 15, 2020 15:19
@bader
Copy link
Contributor

bader commented Apr 23, 2020

Some of the changes are also in PR (some rounding modes) #1463, will remove the WIP once it is merged

@Naghasan, #1464 has been merged.
NOTE: there is another PR changing SPIR-V built-ins - #1576.

@Naghasan Naghasan force-pushed the victor/spirv-fix-builtin-decls branch from e5d0def to a934aab Compare April 24, 2020 12:58
@Naghasan Naghasan changed the title [WIP][SPIR-V] Correct/improve declaration of some SPIR-V builtins [SPIR-V] Correct/improve declaration of some SPIR-V builtins Apr 24, 2020
@Naghasan Naghasan force-pushed the victor/spirv-fix-builtin-decls branch from a934aab to ca75e50 Compare April 24, 2020 13:17
@bader bader requested a review from Fznamznon April 24, 2020 18:00
Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm not an expert in SPIRV built-ins and this tablegen solution yet. @AlexeySachkov @fadeeval , I see that you have been working on it, could you please help with review?
BTW, can we commit it after the change re-using OpenCL address space attributes? #1581 . I guess, then we won't need conversions between sycl and opencl address spaces.

clang/lib/Sema/SPIRVBuiltins.td Outdated Show resolved Hide resolved
@Naghasan
Copy link
Contributor Author

BTW, can we commit it after the change re-using OpenCL address space attributes? #1581 .

I was sure I commented somewhere about this... I agree, this would avoid pushing a workaround.

@Fznamznon
Copy link
Contributor

BTW, can we commit it after the change re-using OpenCL address space attributes? #1581 .

I was sure I commented somewhere about this... I agree, this would avoid pushing a workaround.

#1581 has been merged.

Make the address space overloads more flexible by supporting OpenCL and SYCL.

Correct the signature of __spirv_ocl_native_* and __spirv_ocl_half_* builtins.
Correct the naming of overloads of __spirv_ocl_vload* and __spirv_ocl_vstore* builtins.
Add missing overloads for conversion with specific rounding modes and saturation.
Remove inexistent __spirv_All(bool) and __spirv_Any(bool) overloads.

Signed-off-by: Victor Lomuller <victor@codeplay.com>
@Naghasan Naghasan force-pushed the victor/spirv-fix-builtin-decls branch from ca75e50 to ad01615 Compare April 30, 2020 09:16
@Naghasan
Copy link
Contributor Author

@Fznamznon I rebased to tip, the address space work around is now gone 🎉

@erichkeane
Copy link
Contributor

I don't understand the purpose of the changes enough to review, so @bader s review will have to be enough (or we wait for @Fznamznon to return).

@pvchupin pvchupin merged commit 5beec6d into intel:sycl May 1, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request May 6, 2020
…_docs

* origin/sycl: (6482 commits)
  [SYCL][NFC] Clean formatting in Markdown documents (intel#1635)
  [SYCL][Doc] Remove obsolete parens from README (intel#1637)
  [SYCL] Fix failing ABI tests when LLVM_LIBDIR_SUFFIX is set (intel#1605)
  [SYCL] Fix warnings in libdevice (intel#1630)
  [SYCL][CUDA] Triage and clean LIT (intel#1620)
  [SYCL][NFC] Fix GCC 8 compilation warnings (intel#1631)
  [SYCL] Minor fixes in LowerWGScope
  [SYCL] PI: correct default interoperability plugin selection
  [SYCL] Add faster reduction implementations using atomic or/and intel::reduce() (intel#1615)
  [SYCL] Add sycl-ls utility for listing devices discovered/selected by SYCL RT (intel#1575)
  [SYCL] Fix getDeviceFromHandler declarations (intel#1626)
  [SPIR-V] Correct/improve declaration of SPIR-V builtins (intel#1519)
  [SYCL][USM] Improve USM allocator test and fix improper behavior. (intel#1538)
  [SYCL] Fix failing ABI LITs (intel#1622)
  [SYCL] Add support for MSVC internal math functions in device library (intel#1441)
  [SYCL] Add runtime library versioning (intel#1604)
  [SYCL] Check weak symbols in ABI dumps (intel#1609)
  [NFC][SYCL] Improve kernel metadata test (intel#1610)
  Revert "[SYCL] XFAIL LIT test due to duplicate diagnostic" (intel#1460)
  [SYCL] Move the reduction command group funcs out of handler.hpp (intel#1602)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants