Re: PATCH: re-enable OpenCL extensions
On 19.01.2017 23:43, Liu, Yaxun (Sam) wrote: I think the supported extensions for a target should be as accurate as possible, for it to be useful. Setting all extensions to be supported on all targets will defeat its purpose. I agree on the first part, but arrive at the exact opposite result :) At least ARM, AARch64, PowerPC and MIPS suffer from this now (i.e. the ones someone even tried to compile pocl on). And OCL-C being a front-end option, and OpenCL a stand-alone library, there isn't too much backend target specific stuff going on. I recommend to introduce "pocl" as an environment in the triple and add supported OpenCL extensions for different targets based on that. This does sound like something we should consider. This would at the same time allow for development on the experimental backends. -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Thursday, January 19, Do you think this can be solved instead with the new " -cl-ext=" option: http://clang.llvm.org/docs/UsersManual.html#opencl-specific-options I'll have to have a better, second look at this, thanks. If it don't, I'll file bug reports :) thanks, kalle ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: PATCH: re-enable OpenCL extensions
I think the supported extensions for a target should be as accurate as possible, for it to be useful. Setting all extensions to be supported on all targets will defeat its purpose. I recommend to introduce "pocl" as an environment in the triple and add supported OpenCL extensions for different targets based on that. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Thursday, January 19, 2017 12:31 PM To: Kalle Raiskila Cc: cfe-commits@lists.llvm.org; Liu, Yaxun (Sam) ; nd Subject: RE: PATCH: re-enable OpenCL extensions As mentioned on cfe-dev as well, although it doesn't seem too critical it is generally not logical to enable all extensions by default because most of the targets don't even support OpenCL. But I understand your situation with using x86 or ARM backends in a generic way. Do you think this can be solved instead with the new " -cl-ext=" option: http://clang.llvm.org/docs/UsersManual.html#opencl-specific-options May be Sam could comment more since he has done most work with the extensions lately. Cheers, Anastasia -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Kalle Raiskila via cfe-commits Sent: 19 January 2017 08:03 To: cfe-commits@lists.llvm.org Subject: PATCH: re-enable OpenCL extensions Hi, I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension pragmas per default. This broke pocl on e.g. ARM for LLVM 3.9 (https://github.com/pocl/pocl/issues/409). Example: $ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl works fine, but: $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl --target=armv7-unknown-linux-gnueabihf hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring [-Wignored-pragmas] #pragma OPENCL EXTENSION cl_khr_icd: enable ^ 1 warning generated. Attached is a patch that enables OpenCL extensions for all targets per default, and then sets the status quo of supported extensions for those targets that currently customize their settings (i.e. NVPTX and AMDGPU). Most generic CPUs can handle all OpenCL extensions just fine. Please keep me as CC, I am not subscribed to the list. thanks, kalle ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: PATCH: re-enable OpenCL extensions
As mentioned on cfe-dev as well, although it doesn't seem too critical it is generally not logical to enable all extensions by default because most of the targets don't even support OpenCL. But I understand your situation with using x86 or ARM backends in a generic way. Do you think this can be solved instead with the new " -cl-ext=" option: http://clang.llvm.org/docs/UsersManual.html#opencl-specific-options May be Sam could comment more since he has done most work with the extensions lately. Cheers, Anastasia -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Kalle Raiskila via cfe-commits Sent: 19 January 2017 08:03 To: cfe-commits@lists.llvm.org Subject: PATCH: re-enable OpenCL extensions Hi, I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension pragmas per default. This broke pocl on e.g. ARM for LLVM 3.9 (https://github.com/pocl/pocl/issues/409). Example: $ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl works fine, but: $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl --target=armv7-unknown-linux-gnueabihf hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring [-Wignored-pragmas] #pragma OPENCL EXTENSION cl_khr_icd: enable ^ 1 warning generated. Attached is a patch that enables OpenCL extensions for all targets per default, and then sets the status quo of supported extensions for those targets that currently customize their settings (i.e. NVPTX and AMDGPU). Most generic CPUs can handle all OpenCL extensions just fine. Please keep me as CC, I am not subscribed to the list. thanks, kalle ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
PATCH: re-enable OpenCL extensions
Hi, I noticed a change from clang 3.8 to 3.9, that it disabled all OpenCL extension pragmas per default. This broke pocl on e.g. ARM for LLVM 3.9 (https://github.com/pocl/pocl/issues/409). Example: $ echo "#pragma OPENCL EXTENSION cl_khr_icd: enable" > hello.cl $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl works fine, but: $ clang -emit-llvm -x cl -o tmp.bc -c hello.cl --target=armv7-unknown-linux-gnueabihf hello.cl:1:26: warning: unsupported OpenCL extension 'cl_khr_icd' - ignoring [-Wignored-pragmas] #pragma OPENCL EXTENSION cl_khr_icd: enable ^ 1 warning generated. Attached is a patch that enables OpenCL extensions for all targets per default, and then sets the status quo of supported extensions for those targets that currently customize their settings (i.e. NVPTX and AMDGPU). Most generic CPUs can handle all OpenCL extensions just fine. Please keep me as CC, I am not subscribed to the list. thanks, kalle diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 208f8e8..8b5c38e 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -1008,7 +1008,9 @@ public: virtual bool allowsLargerPreferedTypeAlignment() const { return true; } /// \brief Set supported OpenCL extensions and optional core features. - virtual void setSupportedOpenCLOpts() {} + virtual void setSupportedOpenCLOpts() { +getSupportedOpenCLOpts().supportAll(); + } /// \brief Set supported OpenCL extensions as written on command line virtual void setOpenCLExtensionOpts() { diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 89e3f3e..212ab99 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1951,6 +1951,7 @@ public: } void setSupportedOpenCLOpts() override { auto &Opts = getSupportedOpenCLOpts(); +Opts.supportAll(false); Opts.support("cl_clang_storage_class_specifiers"); Opts.support("cl_khr_gl_sharing"); Opts.support("cl_khr_icd"); @@ -2220,6 +2221,7 @@ public: void setSupportedOpenCLOpts() override { auto &Opts = getSupportedOpenCLOpts(); +Opts.supportAll(false); Opts.support("cl_clang_storage_class_specifiers"); Opts.support("cl_khr_icd"); @@ -2984,10 +2986,6 @@ public: bool hasSjLjLowering() const override { return true; } - - void setSupportedOpenCLOpts() override { -getSupportedOpenCLOpts().supportAll(); - } }; bool X86TargetInfo::setFPMath(StringRef Name) { @@ -8270,12 +8268,6 @@ public: CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override { return CC_SpirFunction; } - - void setSupportedOpenCLOpts() override { -// Assume all OpenCL extensions and optional core features are supported -// for SPIR since it is a generic target. -getSupportedOpenCLOpts().supportAll(); - } }; class SPIR32TargetInfo : public SPIRTargetInfo { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits