Skip to content

Commit 899fc02

Browse files
dchigarevAndreyPavlenko
authored andcommitted
fix insert allocs
Signed-off-by: dchigarev <[email protected]>
1 parent ee45972 commit 899fc02

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lib/Transforms/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ add_mlir_library(IMEXTransforms
2424
MLIRSupport
2525
MLIRTransformUtils
2626
MLIRVectorTransforms
27+
IMEXXeTileDialect
28+
IMEXRegionDialect
2729

2830
DEPENDS
2931
IMEXTransformsPassIncGen
32+
IMEXXeTilePassIncGen
33+
MLIRRegionOpsIncGen
3034
)

lib/Transforms/InsertGPUAllocs.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class InsertGPUAllocsPass final
4444
: public imex::impl::InsertGPUAllocsBase<InsertGPUAllocsPass> {
4545

4646
public:
47-
explicit InsertGPUAllocsPass() : m_clientAPI("vulkan") {}
47+
explicit InsertGPUAllocsPass() : m_clientAPI("opencl") {}
4848
explicit InsertGPUAllocsPass(const mlir::StringRef &clientAPI)
4949
: m_clientAPI(clientAPI) {}
5050

@@ -411,6 +411,15 @@ class InsertGPUAllocsPass final
411411
use.set(newAlloc.getResult());
412412
}
413413
}
414+
415+
// remove 'memref.dealloc' (it's later replaced with gpu.dealloc)
416+
auto memory = alloc->getResult(0);
417+
for (auto u : memory.getUsers()) {
418+
if (auto dealloc = mlir::dyn_cast<mlir::memref::DeallocOp>(u)) {
419+
dealloc.erase();
420+
}
421+
}
422+
414423
alloc.replaceAllUsesWith(allocResult);
415424
builder.create<mlir::gpu::DeallocOp>(loc, std::nullopt, allocResult);
416425
alloc.erase();

lib/Transforms/SetSPIRVAbiAttribute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace {
3232
class SetSPIRVAbiAttributePass
3333
: public imex::impl::SetSPIRVAbiAttributeBase<SetSPIRVAbiAttributePass> {
3434
public:
35-
explicit SetSPIRVAbiAttributePass() { m_clientAPI = "vulkan"; }
35+
explicit SetSPIRVAbiAttributePass() { m_clientAPI = "opencl"; }
3636
explicit SetSPIRVAbiAttributePass(const mlir::StringRef &clientAPI)
3737
: m_clientAPI(clientAPI) {}
3838

0 commit comments

Comments
 (0)