mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-13 19:32:41 +00:00
[GPGPU] Use separate basic block for GPU initialization code
This increases the readability of the IR and also clarifies that the GPU inititialization is executed _after_ the scalar initialization which needs to before the code of the transformed scop is executed. Besides increased readability, the IR should not change. Specifically, I do not expect any changes in program semantics due to this patch. llvm-svn: 278125
This commit is contained in:
parent
776700d0b7
commit
750160e260
@ -35,6 +35,7 @@
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
|
||||
#include "isl/union_map.h"
|
||||
|
||||
@ -436,6 +437,11 @@ private:
|
||||
};
|
||||
|
||||
void GPUNodeBuilder::initializeAfterRTH() {
|
||||
BasicBlock *NewBB = SplitBlock(Builder.GetInsertBlock(),
|
||||
&*Builder.GetInsertPoint(), &DT, &LI);
|
||||
NewBB->setName("polly.acc.initialize");
|
||||
Builder.SetInsertPoint(&NewBB->front());
|
||||
|
||||
GPUContext = createCallInitContext();
|
||||
allocateDeviceArrays();
|
||||
}
|
||||
|
@ -92,6 +92,9 @@
|
||||
; IR-NEXT: br i1 true, label %polly.start, label %bb2
|
||||
|
||||
; IR: polly.start:
|
||||
; IR-NEXT: br label %polly.acc.initialize
|
||||
|
||||
; IR: polly.acc.initialize:
|
||||
; IR-NEXT: [[GPUContext:%.*]] = call i8* @polly_initContext()
|
||||
; IR-NEXT: %p_dev_array_MemRef_A = call i8* @polly_allocateMemoryForDevice(i64 4194304)
|
||||
; IR-NEXT: [[HostPtr:%.*]] = bitcast [1024 x float]* %A to i8*
|
||||
|
Loading…
x
Reference in New Issue
Block a user