r308741 - Test commit
Author: nhaustov Date: Fri Jul 21 06:58:11 2017 New Revision: 308741 URL: http://llvm.org/viewvc/llvm-project?rev=308741=rev Log: Test commit Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp?rev=308741=308740=308741=diff == --- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Fri Jul 21 06:58:11 2017 @@ -35,7 +35,7 @@ void amdgpu::Linker::ConstructJob(Compil CmdArgs, Inputs)); } -/// AMDGPU Toolchain +/// AMDGPU Toolchain AMDGPUToolChain::AMDGPUToolChain(const Driver , const llvm::Triple , const ArgList ) : Generic_ELF(D, Triple, Args) { } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23071: [OpenCL] Remove extra native_ functions from opencl-c.h
nhaustov accepted this revision. nhaustov added a comment. This revision is now accepted and ready to land. LGTM, thanks. Could you also note in commit message that online HTML docs are not very clear, but pdf of OpenCL specification has it right. Repository: rL LLVM https://reviews.llvm.org/D23071 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22940: [OpenCL] Handle -cl-fp32-correctly-rounded-divide-sqrt
nhaustov accepted this revision. nhaustov added a comment. This revision is now accepted and ready to land. Ok. https://reviews.llvm.org/D22940 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r274220 - AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
Author: nhaustov Date: Thu Jun 30 04:06:33 2016 New Revision: 274220 URL: http://llvm.org/viewvc/llvm-project?rev=274220=rev Log: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels. Summary: Summary: Change Clang calling convention SpirKernel to OpenCLKernel. Set calling convention OpenCLKernel for amdgcn as well. Add virtual method .getOpenCLKernelCallingConv() to TargetCodeGenInfo and use it to set target calling convention for AMDGPU and SPIR. Update tests. Reviewers: rsmith, tstellarAMD, Anastasia, yaxunl Subscribers: kzhuravl, cfe-commits Differential Revision: http://reviews.llvm.org/D21367 Added: cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl (with props) cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl Modified: cfe/trunk/include/clang/Basic/Specifiers.h cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/AST/TypePrinter.cpp cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CodeGenTypes.h cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/lib/CodeGen/TargetInfo.h cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl cfe/trunk/tools/libclang/CXType.cpp Modified: cfe/trunk/include/clang/Basic/Specifiers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=274220=274219=274220=diff == --- cfe/trunk/include/clang/Basic/Specifiers.h (original) +++ cfe/trunk/include/clang/Basic/Specifiers.h Thu Jun 30 04:06:33 2016 @@ -241,7 +241,7 @@ namespace clang { CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) CC_IntelOclBicc, // __attribute__((intel_ocl_bicc)) CC_SpirFunction, // default for OpenCL functions on SPIR target -CC_SpirKernel, // inferred for OpenCL kernels on SPIR target +CC_OpenCLKernel, // inferred for OpenCL kernels CC_Swift,// __attribute__((swiftcall)) CC_PreserveMost, // __attribute__((preserve_most)) CC_PreserveAll, // __attribute__((preserve_all)) @@ -257,7 +257,7 @@ namespace clang { case CC_X86Pascal: case CC_X86VectorCall: case CC_SpirFunction: -case CC_SpirKernel: +case CC_OpenCLKernel: case CC_Swift: return false; default: Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=274220=274219=274220=diff == --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original) +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Jun 30 04:06:33 2016 @@ -2161,7 +2161,7 @@ StringRef CXXNameMangler::getCallingConv case CC_AAPCS_VFP: case CC_IntelOclBicc: case CC_SpirFunction: - case CC_SpirKernel: + case CC_OpenCLKernel: case CC_PreserveMost: case CC_PreserveAll: // FIXME: we should be mangling all of the above. Modified: cfe/trunk/lib/AST/Type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=274220=274219=274220=diff == --- cfe/trunk/lib/AST/Type.cpp (original) +++ cfe/trunk/lib/AST/Type.cpp Thu Jun 30 04:06:33 2016 @@ -2642,7 +2642,7 @@ StringRef FunctionType::getNameForCallCo case CC_AAPCS_VFP: return "aapcs-vfp"; case CC_IntelOclBicc: return "intel_ocl_bicc"; case CC_SpirFunction: return "spir_function"; - case CC_SpirKernel: return "spir_kernel"; + case CC_OpenCLKernel: return "opencl_kernel"; case CC_Swift: return "swiftcall"; case CC_PreserveMost: return "preserve_most"; case CC_PreserveAll: return "preserve_all"; Modified: cfe/trunk/lib/AST/TypePrinter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=274220=274219=274220=diff == --- cfe/trunk/lib/AST/TypePrinter.cpp (original) +++ cfe/trunk/lib/AST/TypePrinter.cpp Thu Jun 30 04:06:33 2016 @@ -725,7 +725,7 @@ void TypePrinter::printFunctionProtoAfte OS << " __attribute__((sysv_abi))"; break; case CC_SpirFunction: -case CC_SpirKernel: +case CC_OpenCLKernel: // Do nothing. These CCs are not available as attributes. break; case CC_Swift: Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=274220=274219=274220=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Jun 30 04:06:33 2016 @@ -2137,6 +2137,16 @@ public: Opts.cl_khr_3d_image_writes = 1; } } + + CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { +switch (CC) { + default: +return CCCR_Warning; + case
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
This revision was automatically updated to reflect the committed changes. Closed by commit rL274220: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels. (authored by nhaustov). Changed prior to commit: http://reviews.llvm.org/D21367?vs=62198=62343#toc Repository: rL LLVM http://reviews.llvm.org/D21367 Files: cfe/trunk/include/clang/Basic/Specifiers.h cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/AST/TypePrinter.cpp cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CodeGenTypes.h cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/lib/CodeGen/TargetInfo.h cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl cfe/trunk/tools/libclang/CXType.cpp Index: cfe/trunk/include/clang/Basic/Specifiers.h === --- cfe/trunk/include/clang/Basic/Specifiers.h +++ cfe/trunk/include/clang/Basic/Specifiers.h @@ -241,7 +241,7 @@ CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) CC_IntelOclBicc, // __attribute__((intel_ocl_bicc)) CC_SpirFunction, // default for OpenCL functions on SPIR target -CC_SpirKernel, // inferred for OpenCL kernels on SPIR target +CC_OpenCLKernel, // inferred for OpenCL kernels CC_Swift,// __attribute__((swiftcall)) CC_PreserveMost, // __attribute__((preserve_most)) CC_PreserveAll, // __attribute__((preserve_all)) @@ -257,7 +257,7 @@ case CC_X86Pascal: case CC_X86VectorCall: case CC_SpirFunction: -case CC_SpirKernel: +case CC_OpenCLKernel: case CC_Swift: return false; default: Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl @@ -0,0 +1,14 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s +// CHECK: define amdgpu_kernel void @test_call_kernel(i32 addrspace(1)* nocapture %out) +// CHECK: store i32 4, i32 addrspace(1)* %out, align 4 + +kernel void test_kernel(global int *out) +{ + out[0] = 4; +} + +__kernel void test_call_kernel(__global int *out) +{ + test_kernel(out); +} Index: cfe/trunk/lib/AST/Type.cpp === --- cfe/trunk/lib/AST/Type.cpp +++ cfe/trunk/lib/AST/Type.cpp @@ -2642,7 +2642,7 @@ case CC_AAPCS_VFP: return "aapcs-vfp"; case CC_IntelOclBicc: return "intel_ocl_bicc"; case CC_SpirFunction: return "spir_function"; - case CC_SpirKernel: return "spir_kernel"; + case CC_OpenCLKernel: return "opencl_kernel"; case CC_Swift: return "swiftcall"; case
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov updated this revision to Diff 62198. nhaustov added a comment. Update after discussion with Sam and review from Anastasia. http://reviews.llvm.org/D21367 Files: include/clang/Basic/Specifiers.h lib/AST/ItaniumMangle.cpp lib/AST/Type.cpp lib/AST/TypePrinter.cpp lib/Basic/Targets.cpp lib/CodeGen/CGCall.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CodeGenTypes.h lib/CodeGen/TargetInfo.cpp lib/CodeGen/TargetInfo.h lib/Sema/SemaType.cpp test/CodeGenOpenCL/amdgpu-call-kernel.cl test/CodeGenOpenCL/amdgpu-calling-conv.cl test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -541,7 +541,7 @@ TCALLINGCONV(PreserveMost); TCALLINGCONV(PreserveAll); case CC_SpirFunction: return CXCallingConv_Unexposed; -case CC_SpirKernel: return CXCallingConv_Unexposed; +case CC_OpenCLKernel: return CXCallingConv_Unexposed; break; } #undef TCALLINGCONV Index: test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: test/CodeGenOpenCL/amdgpu-call-kernel.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-call-kernel.cl @@ -0,0 +1,14 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s +// CHECK: define amdgpu_kernel void @test_call_kernel(i32 addrspace(1)* nocapture %out) +// CHECK: store i32 4, i32 addrspace(1)* %out, align 4 + +kernel void test_kernel(global int *out) +{ + out[0] = 4; +} + +__kernel void test_call_kernel(__global int *out) +{ + test_kernel(out); +} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3182,15 +3182,19 @@ CallingConv CC = S.Context.getDefaultCallingConvention(FTI.isVariadic, IsCXXInstanceMethod); - // Attribute AT_OpenCLKernel affects the calling convention only on - // the SPIR target, hence it cannot be treated as a calling + // Attribute AT_OpenCLKernel affects the calling convention for SPIR + // and AMDGPU targets, hence it cannot be treated as a calling // convention attribute. This is the simplest place to infer - // "spir_kernel" for OpenCL kernels on SPIR. - if (CC == CC_SpirFunction) { + // calling convention for OpenCL kernels. + if (S.getLangOpts().OpenCL) { for (const AttributeList *Attr = D.getDeclSpec().getAttributes().getList(); Attr; Attr = Attr->getNext()) { if (Attr->getKind() == AttributeList::AT_OpenCLKernel) { -CC = CC_SpirKernel; +llvm::Triple::ArchType arch = S.Context.getTargetInfo().getTriple().getArch(); +if (arch == llvm::Triple::spir || arch == llvm::Triple::spir64 || +arch == llvm::Triple::amdgcn) { + CC = CC_OpenCLKernel; +} break; } } Index: lib/CodeGen/TargetInfo.h
r273997 - [Driver] Add method to redirect output of Compilation.
Author: nhaustov Date: Tue Jun 28 03:00:42 2016 New Revision: 273997 URL: http://llvm.org/viewvc/llvm-project?rev=273997=rev Log: [Driver] Add method to redirect output of Compilation. Summary: Currently output of child process, however in my use case, it needs to be captured and presented to the user. Add Redirect method to Compilation and use existing infrastructure for redirecting output of commands. Reviewers: tstellarAMD Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21224 Modified: cfe/trunk/include/clang/Driver/Compilation.h cfe/trunk/lib/Driver/Compilation.cpp Modified: cfe/trunk/include/clang/Driver/Compilation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=273997=273996=273997=diff == --- cfe/trunk/include/clang/Driver/Compilation.h (original) +++ cfe/trunk/include/clang/Driver/Compilation.h Tue Jun 28 03:00:42 2016 @@ -252,6 +252,15 @@ public: /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// Redirect - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver Modified: cfe/trunk/lib/Driver/Compilation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=273997=273996=273997=diff == --- cfe/trunk/lib/Driver/Compilation.cpp (original) +++ cfe/trunk/lib/Driver/Compilation.cpp Tue Jun 28 03:00:42 2016 @@ -45,6 +45,7 @@ Compilation::~Compilation() { // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ void Compilation::initCompilationForDiag StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
This revision was automatically updated to reflect the committed changes. Closed by commit rL273997: [Driver] Add method to redirect output of Compilation. (authored by nhaustov). Changed prior to commit: http://reviews.llvm.org/D21224?vs=60333=62066#toc Repository: rL LLVM http://reviews.llvm.org/D21224 Files: cfe/trunk/include/clang/Driver/Compilation.h cfe/trunk/lib/Driver/Compilation.cpp Index: cfe/trunk/include/clang/Driver/Compilation.h === --- cfe/trunk/include/clang/Driver/Compilation.h +++ cfe/trunk/include/clang/Driver/Compilation.h @@ -252,6 +252,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// Redirect - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver Index: cfe/trunk/lib/Driver/Compilation.cpp === --- cfe/trunk/lib/Driver/Compilation.cpp +++ cfe/trunk/lib/Driver/Compilation.cpp @@ -45,6 +45,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: cfe/trunk/include/clang/Driver/Compilation.h === --- cfe/trunk/include/clang/Driver/Compilation.h +++ cfe/trunk/include/clang/Driver/Compilation.h @@ -252,6 +252,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// Redirect - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver Index: cfe/trunk/lib/Driver/Compilation.cpp === --- cfe/trunk/lib/Driver/Compilation.cpp +++ cfe/trunk/lib/Driver/Compilation.cpp @@ -45,6 +45,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov added a comment. In http://reviews.llvm.org/D21367#467894, @yaxunl wrote: > I am wondering what's the difference between this calling convention and > spir_kernel. spir_kernel has only effect and was created only for SPIR target. In theory it could perhaps be reused for AMDGPU target, however it seems not very clear to me. In http://reviews.llvm.org/D21367#468057, @yaxunl wrote: > In http://reviews.llvm.org/D21367#467982, @nhaustov wrote: > > > In http://reviews.llvm.org/D21367#467894, @yaxunl wrote: > > > > > I am wondering what's the difference between this calling convention and > > > spir_kernel. > > > > > > spir_kernel has only effect and was created only for SPIR target. In theory > > it could perhaps be reused for AMDGPU target, however it seems not very > > clear to me. > > > If the new calling convention is to indicate a function is an OpenCL kernel, > then it has exactly the same meaning as spir_kernel. Can we just use it in > AMDGPU target? This looks like a hack to me. Calling conventions in LLVM IR are really target specific. spir_kernel really doesn't make sense for anything other than SPIR. Maybe we can use the fact that calling conventions are separate in AST and in LLVM IR. So in AST maybe we can have opencl_kernel and in LLVM it can map to spir_kernel for SPIR and amdgpu_kernel for AMDGPU. http://reviews.llvm.org/D21367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov added a comment. In http://reviews.llvm.org/D21367#467894, @yaxunl wrote: > I am wondering what's the difference between this calling convention and > spir_kernel. spir_kernel has only effect and was created only for SPIR target. In theory it could perhaps be reused for AMDGPU target, however it seems not very clear to me. http://reviews.llvm.org/D21367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov added a comment. Ping. http://reviews.llvm.org/D21224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov updated this revision to Diff 61247. nhaustov added a comment. Add test for calling OpenCL kernel from kernel. http://reviews.llvm.org/D21367 Files: include/clang/AST/Type.h include/clang/Basic/Specifiers.h lib/AST/ItaniumMangle.cpp lib/AST/Type.cpp lib/AST/TypePrinter.cpp lib/Basic/Targets.cpp lib/CodeGen/CGCall.cpp lib/CodeGen/CGDebugInfo.cpp lib/Sema/SemaType.cpp test/CodeGenOpenCL/amdgpu-call-kernel.cl test/CodeGenOpenCL/amdgpu-calling-conv.cl test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -542,6 +542,7 @@ TCALLINGCONV(PreserveAll); case CC_SpirFunction: return CXCallingConv_Unexposed; case CC_SpirKernel: return CXCallingConv_Unexposed; +case CC_AMDGPUKernel: return CXCallingConv_Unexposed; break; } #undef TCALLINGCONV Index: test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: test/CodeGenOpenCL/amdgpu-call-kernel.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-call-kernel.cl @@ -0,0 +1,14 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s +// CHECK: define amdgpu_kernel void @test_call_kernel(i32 addrspace(1)* nocapture %out) +// CHECK: store i32 4, i32 addrspace(1)* %out, align 4 + +kernel void test_kernel(global int *out) +{ + out[0] = 4; +} + +__kernel void test_call_kernel(__global int *out) +{ + test_kernel(out); +} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3182,15 +3182,20 @@ CallingConv CC = S.Context.getDefaultCallingConvention(FTI.isVariadic, IsCXXInstanceMethod); - // Attribute AT_OpenCLKernel affects the calling convention only on - // the SPIR target, hence it cannot be treated as a calling + // Attribute AT_OpenCLKernel affects the calling convention for SPIR + // and AMDGPU targets, hence it cannot be treated as a calling // convention attribute. This is the simplest place to infer - // "spir_kernel" for OpenCL kernels on SPIR. - if (CC == CC_SpirFunction) { + // calling convention for OpenCL kernels. + if (S.getLangOpts().OpenCL) { for (const AttributeList *Attr = D.getDeclSpec().getAttributes().getList(); Attr; Attr = Attr->getNext()) { if (Attr->getKind() == AttributeList::AT_OpenCLKernel) { -CC = CC_SpirKernel; +llvm::Triple::ArchType arch = S.Context.getTargetInfo().getTriple().getArch(); +if (arch == llvm::Triple::spir || arch == llvm::Triple::spir64) { + CC = CC_SpirKernel; +} else if (arch == llvm::Triple::amdgcn) { + CC = CC_AMDGPUKernel; +} break; } } Index: lib/CodeGen/CGDebugInfo.cpp === ---
Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov added a comment. In http://reviews.llvm.org/D21367#461480, @tstellarAMD wrote: > Does this new patch fix the OpenCL regression? Yes, it fixes the problem with calling kernel from kernel. I'll add a test too. http://reviews.llvm.org/D21367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.
nhaustov created this revision. nhaustov added reviewers: tstellarAMD, rsmith. nhaustov added a subscriber: cfe-commits. Herald added a subscriber: kzhuravl. Extend CC field of FunctionType to 5 bits and ExtInfo to 10 bits to make space for new calling convention. Add new Clang calling convention CC_AMDGPUKernel. Set calling convention CC_AMDGPUKernel in same place as SPIR target (see comment). Update tests. http://reviews.llvm.org/D21367 Files: include/clang/AST/Type.h include/clang/Basic/Specifiers.h lib/AST/ItaniumMangle.cpp lib/AST/Type.cpp lib/AST/TypePrinter.cpp lib/Basic/Targets.cpp lib/CodeGen/CGCall.cpp lib/CodeGen/CGDebugInfo.cpp lib/Sema/SemaType.cpp test/CodeGenOpenCL/amdgpu-calling-conv.cl test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -542,6 +542,7 @@ TCALLINGCONV(PreserveAll); case CC_SpirFunction: return CXCallingConv_Unexposed; case CC_SpirKernel: return CXCallingConv_Unexposed; +case CC_AMDGPUKernel: return CXCallingConv_Unexposed; break; } #undef TCALLINGCONV Index: test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3182,15 +3182,20 @@ CallingConv CC = S.Context.getDefaultCallingConvention(FTI.isVariadic, IsCXXInstanceMethod); - // Attribute AT_OpenCLKernel affects the calling convention only on - // the SPIR target, hence it cannot be treated as a calling + // Attribute AT_OpenCLKernel affects the calling convention for SPIR + // and AMDGPU targets, hence it cannot be treated as a calling // convention attribute. This is the simplest place to infer - // "spir_kernel" for OpenCL kernels on SPIR. - if (CC == CC_SpirFunction) { + // calling convention for OpenCL kernels. + if (S.getLangOpts().OpenCL) { for (const AttributeList *Attr = D.getDeclSpec().getAttributes().getList(); Attr; Attr = Attr->getNext()) { if (Attr->getKind() == AttributeList::AT_OpenCLKernel) { -CC = CC_SpirKernel; +llvm::Triple::ArchType arch = S.Context.getTargetInfo().getTriple().getArch(); +if (arch == llvm::Triple::spir || arch == llvm::Triple::spir64) { + CC = CC_SpirKernel; +} else if (arch == llvm::Triple::amdgcn) { + CC = CC_AMDGPUKernel; +} break; } } Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -859,6 +859,7 @@ case CC_Swift: case CC_PreserveMost: case CC_PreserveAll: + case CC_AMDGPUKernel: return 0; } return 0; Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -61,6
Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov updated this revision to Diff 60333. nhaustov updated the summary for this revision. nhaustov added a comment. Fix summary. http://reviews.llvm.org/D21224 Files: include/clang/Driver/Compilation.h lib/Driver/Compilation.cpp Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov created this revision. nhaustov added a reviewer: tstellarAMD. nhaustov added a subscriber: cfe-commits. Currently output of child process, however in my use case, it needs to be captured and presented to the user. Add Redirect method to Compilation and use existing infrastructure for redirecting output of commands. http://reviews.llvm.org/D21224 Files: include/clang/Driver/Compilation.h lib/Driver/Compilation.cpp Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r268740 - Revert "AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels."
Author: nhaustov Date: Fri May 6 10:00:51 2016 New Revision: 268740 URL: http://llvm.org/viewvc/llvm-project?rev=268740=rev Log: Revert "AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels." This reverts commit f7053ec90d0fc56f0837e43c2c759e85b56c21a1. It broke calling OpenCL kernel from another kernel. Removed: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=268740=268739=268740=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri May 6 10:00:51 2016 @@ -6826,14 +6826,6 @@ void AMDGPUTargetCodeGenInfo::setTargetA if (!FD) return; - if (M.getLangOpts().OpenCL) { -if (FD->hasAttr()) { - // Set amdgpu_kernel calling convention for OpenCL kernels. - llvm::Function *Fn = cast(GV); - Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); -} - } - if (const auto Attr = FD->getAttr()) { llvm::Function *F = cast(GV); uint32_t NumVGPR = Attr->getNumVGPR(); Removed: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl?rev=268739=auto == --- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl (original) +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl (removed) @@ -1,12 +0,0 @@ -// REQUIRES: amdgpu-registered-target -// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s - -// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() -kernel void calling_conv_amdgpu_kernel() -{ -} - -// CHECK: define void @calling_conv_none() -void calling_conv_none() -{ -} Modified: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl?rev=268740=268739=268740=diff == --- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl (original) +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Fri May 6 10:00:51 2016 @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r268718 - AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels.
Author: nhaustov Date: Fri May 6 04:15:24 2016 New Revision: 268718 URL: http://llvm.org/viewvc/llvm-project?rev=268718=rev Log: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels. Reviewers: tstellarAMD, arsenm Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19918 Added: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=268718=268717=268718=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri May 6 04:15:24 2016 @@ -6826,6 +6826,14 @@ void AMDGPUTargetCodeGenInfo::setTargetA if (!FD) return; + if (M.getLangOpts().OpenCL) { +if (FD->hasAttr()) { + // Set amdgpu_kernel calling convention for OpenCL kernels. + llvm::Function *Fn = cast(GV); + Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); +} + } + if (const auto Attr = FD->getAttr()) { llvm::Function *F = cast(GV); uint32_t NumVGPR = Attr->getNumVGPR(); Added: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl?rev=268718=auto == --- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl (added) +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl Fri May 6 04:15:24 2016 @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Modified: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl?rev=268718=268717=268718=diff == --- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl (original) +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Fri May 6 04:15:24 2016 @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19918: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels.
This revision was automatically updated to reflect the committed changes. Closed by commit rL268718: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels. (authored by nhaustov). Changed prior to commit: http://reviews.llvm.org/D19918?vs=56141=56389#toc Repository: rL LLVM http://reviews.llvm.org/D19918 Files: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp === --- cfe/trunk/lib/CodeGen/TargetInfo.cpp +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp @@ -6826,6 +6826,14 @@ if (!FD) return; + if (M.getLangOpts().OpenCL) { +if (FD->hasAttr()) { + // Set amdgpu_kernel calling convention for OpenCL kernels. + llvm::Function *Fn = cast(GV); + Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); +} + } + if (const auto Attr = FD->getAttr()) { llvm::Function *F = cast(GV); uint32_t NumVGPR = Attr->getNumVGPR(); Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void
[PATCH] D19918: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels.
nhaustov created this revision. nhaustov added reviewers: tstellarAMD, arsenm. nhaustov added a subscriber: cfe-commits. http://reviews.llvm.org/D19918 Files: lib/CodeGen/TargetInfo.cpp test/CodeGenOpenCL/amdgpu-calling-conv.cl test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl Index: test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: lib/CodeGen/TargetInfo.cpp === --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -6826,6 +6826,14 @@ if (!FD) return; + if (M.getLangOpts().OpenCL) { +if (FD->hasAttr()) { + // Set amdgpu_kernel calling convention for OpenCL kernels. + llvm::Function *Fn = cast(GV); + Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); +} + } + if (const auto Attr = FD->getAttr()) { llvm::Function *F = cast(GV); uint32_t NumVGPR = Attr->getNumVGPR(); Index: test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl === --- test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl +++ test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl @@ -5,23 +5,23 @@ __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics kernel void test_num_vgpr64() { -// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_sgpr32() { -// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics kernel void test_num_vgpr64_sgpr32() { -// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]] } __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics kernel void test_num_sgpr20_vgpr40() { -// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] +// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]] } __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics Index: test/CodeGenOpenCL/amdgpu-calling-conv.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-calling-conv.cl @@ -0,0 +1,12 @@ +// REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel() +kernel void calling_conv_amdgpu_kernel() +{ +} + +// CHECK: define void @calling_conv_none() +void calling_conv_none() +{ +} Index: lib/CodeGen/TargetInfo.cpp === --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -6826,6 +6826,14 @@ if (!FD) return; + if (M.getLangOpts().OpenCL) { +if (FD->hasAttr()) { + // Set amdgpu_kernel