Skip to content

Commit 0891412

Browse files
committed
[mlir][gpu] Pass GPU module to TargetAttrInterface::createObject.
This patch adds an argument to `gpu::TargetAttrInterface::createObject` to pass the GPU module. This is useful as `gpu::ObjectAttr` contains a property dict for metadata, and passing the module allows extracting things like the symbol table and adding it to the property dict.
1 parent e4b0655 commit 0891412

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def GPUTargetAttrInterface : AttrInterface<"TargetAttrInterface"> {
4646
meant to be used for passing additional options that are not in the
4747
attribute.
4848
}], "Attribute", "createObject",
49-
(ins "const SmallVector<char, 0>&":$object,
49+
(ins "::mlir::Operation*":$module,
50+
"const SmallVector<char, 0>&":$object,
5051
"const gpu::TargetOptions&":$options)>
5152
];
5253
}

mlir/lib/Target/LLVM/NVVM/Target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class NVVMTargetAttrImpl
4949
serializeToObject(Attribute attribute, Operation *module,
5050
const gpu::TargetOptions &options) const;
5151

52-
Attribute createObject(Attribute attribute,
52+
Attribute createObject(Attribute attribute, Operation *module,
5353
const SmallVector<char, 0> &object,
5454
const gpu::TargetOptions &options) const;
5555
};
@@ -593,7 +593,7 @@ NVVMTargetAttrImpl::serializeToObject(Attribute attribute, Operation *module,
593593
}
594594

595595
Attribute
596-
NVVMTargetAttrImpl::createObject(Attribute attribute,
596+
NVVMTargetAttrImpl::createObject(Attribute attribute, Operation *module,
597597
const SmallVector<char, 0> &object,
598598
const gpu::TargetOptions &options) const {
599599
auto target = cast<NVVMTargetAttr>(attribute);

mlir/lib/Target/LLVM/ROCDL/Target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ROCDLTargetAttrImpl
6262
serializeToObject(Attribute attribute, Operation *module,
6363
const gpu::TargetOptions &options) const;
6464

65-
Attribute createObject(Attribute attribute,
65+
Attribute createObject(Attribute attribute, Operation *module,
6666
const SmallVector<char, 0> &object,
6767
const gpu::TargetOptions &options) const;
6868
};
@@ -473,7 +473,7 @@ std::optional<SmallVector<char, 0>> ROCDLTargetAttrImpl::serializeToObject(
473473
}
474474

475475
Attribute
476-
ROCDLTargetAttrImpl::createObject(Attribute attribute,
476+
ROCDLTargetAttrImpl::createObject(Attribute attribute, Operation *module,
477477
const SmallVector<char, 0> &object,
478478
const gpu::TargetOptions &options) const {
479479
gpu::CompilationTarget format = options.getCompilationTarget();

mlir/lib/Target/SPIRV/Target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SPIRVTargetAttrImpl
3434
serializeToObject(Attribute attribute, Operation *module,
3535
const gpu::TargetOptions &options) const;
3636

37-
Attribute createObject(Attribute attribute,
37+
Attribute createObject(Attribute attribute, Operation *module,
3838
const SmallVector<char, 0> &object,
3939
const gpu::TargetOptions &options) const;
4040
};
@@ -89,7 +89,7 @@ std::optional<SmallVector<char, 0>> SPIRVTargetAttrImpl::serializeToObject(
8989

9090
// Prepare Attribute for gpu.binary with serialized kernel object
9191
Attribute
92-
SPIRVTargetAttrImpl::createObject(Attribute attribute,
92+
SPIRVTargetAttrImpl::createObject(Attribute attribute, Operation *module,
9393
const SmallVector<char, 0> &object,
9494
const gpu::TargetOptions &options) const {
9595
gpu::CompilationTarget format = options.getCompilationTarget();

0 commit comments

Comments
 (0)