forked from OSchip/llvm-project
GPGPU: add host iterators to kernel arguments
llvm-svn: 275954
This commit is contained in:
parent
472f9654c8
commit
f6044bd0ef
|
@ -140,7 +140,7 @@ private:
|
|||
/// The kernel function takes as arguments:
|
||||
///
|
||||
/// - One i8 pointer for each external array reference used in the kernel.
|
||||
/// - Host iterators (TODO)
|
||||
/// - Host iterators
|
||||
/// - Parameters (TODO)
|
||||
/// - Other LLVM Value references (TODO)
|
||||
///
|
||||
|
@ -223,6 +223,11 @@ Function *GPUNodeBuilder::createKernelFunctionDecl(ppcg_kernel *Kernel) {
|
|||
Args.push_back(Builder.getInt8PtrTy());
|
||||
}
|
||||
|
||||
int NumHostIters = isl_space_dim(Kernel->space, isl_dim_set);
|
||||
|
||||
for (long i = 0; i < NumHostIters; i++)
|
||||
Args.push_back(Builder.getInt64Ty());
|
||||
|
||||
auto *FT = FunctionType::get(Builder.getVoidTy(), Args, false);
|
||||
auto *FN = Function::Create(FT, Function::ExternalLinkage, Identifier,
|
||||
GPUModule.get());
|
||||
|
@ -237,6 +242,14 @@ Function *GPUNodeBuilder::createKernelFunctionDecl(ppcg_kernel *Kernel) {
|
|||
Arg++;
|
||||
}
|
||||
|
||||
for (long i = 0; i < NumHostIters; i++) {
|
||||
isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_set, i);
|
||||
Arg->setName(isl_id_get_name(Id));
|
||||
IDToValue[Id] = &*Arg;
|
||||
KernelIDs.insert(std::unique_ptr<isl_id, IslIdDeleter>(Id));
|
||||
Arg++;
|
||||
}
|
||||
|
||||
return FN;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
; RUN: opt %loadPolly -polly-codegen-ppcg -disable-output \
|
||||
; RUN: -polly-acc-dump-code < %s | FileCheck %s -check-prefix=CODE
|
||||
|
||||
; RUN: opt %loadPolly -polly-codegen-ppcg -disable-output \
|
||||
; RUN: -polly-acc-dump-kernel-ir < %s | FileCheck %s -check-prefix=KERNEL-IR
|
||||
|
||||
; RUN: opt %loadPolly -polly-codegen-ppcg \
|
||||
; RUN: -S < %s | FileCheck %s -check-prefix=IR
|
||||
; void foo(float A[2][100]) {
|
||||
|
@ -31,6 +34,15 @@
|
|||
; IR-NEXT: %polly.loop_cond = icmp sle i64 %polly.indvar, 98
|
||||
; IR-NEXT: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
|
||||
|
||||
; KERNEL-IR: define ptx_kernel void @kernel_0(i8* %MemRef_A, i64 %c0) {
|
||||
; KERNEL-IR-NEXT: entry:
|
||||
; KERNEL-IR-NEXT: %0 = call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x()
|
||||
; KERNEL-IR-NEXT: %b0 = zext i32 %0 to i64
|
||||
; KERNEL-IR-NEXT: %1 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
||||
; KERNEL-IR-NEXT: %t0 = zext i32 %1 to i64
|
||||
; KERNEL-IR-NEXT: ret void
|
||||
; KERNEL-IR-NEXT: }
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
||||
define void @foo([100 x float]* %A) {
|
||||
|
|
Loading…
Reference in New Issue