Skip to content

Commit b8b3c18

Browse files
committed
Select first target env when targets array has more than one target env
1 parent 3703a1e commit b8b3c18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,11 @@ LogicalResult GPUModuleConversion::matchAndRewrite(
387387
spvModule->setAttr(spirv::getTargetEnvAttrName(), attr);
388388
if (ArrayAttr targets = moduleOp.getTargetsAttr()) {
389389
for (Attribute targetAttr : targets)
390-
if (auto spirvTargetEnvAttr = dyn_cast<spirv::TargetEnvAttr>(targetAttr))
390+
if (auto spirvTargetEnvAttr =
391+
dyn_cast<spirv::TargetEnvAttr>(targetAttr)) {
391392
spvModule->setAttr(spirv::getTargetEnvAttrName(), spirvTargetEnvAttr);
393+
break;
394+
}
392395
}
393396

394397
rewriter.eraseOp(moduleOp);

0 commit comments

Comments
 (0)