[Mlir-commits] [mlir] [mlir][gpu] Pass GPU module to `TargetAttrInterface::createObject`. (PR #94910)
Mehdi Amini
llvmlistbot at llvm.org
Wed Jun 12 16:23:26 PDT 2024
================
@@ -593,18 +593,21 @@ NVVMTargetAttrImpl::serializeToObject(Attribute attribute, Operation *module,
}
Attribute
-NVVMTargetAttrImpl::createObject(Attribute attribute,
+NVVMTargetAttrImpl::createObject(Attribute attribute, Operation *module,
const SmallVector<char, 0> &object,
const gpu::TargetOptions &options) const {
auto target = cast<NVVMTargetAttr>(attribute);
gpu::CompilationTarget format = options.getCompilationTarget();
- DictionaryAttr objectProps;
+ DictionaryAttr objectProps = module->getDiscardableAttrDictionary();
Builder builder(attribute.getContext());
- if (format == gpu::CompilationTarget::Assembly)
- objectProps = builder.getDictionaryAttr(
- {builder.getNamedAttr("O", builder.getI32IntegerAttr(target.getO()))});
+ if (format == gpu::CompilationTarget::Assembly) {
+ SmallVector<NamedAttribute, 1> attrs(objectProps.getValue());
+ attrs.push_back(
+ builder.getNamedAttr("O", builder.getI32IntegerAttr(target.getO())));
----------------
joker-eph wrote:
What if `O` was already in the dictionary?
https://github.com/llvm/llvm-project/pull/94910
More information about the Mlir-commits
mailing list