Skip to content

Commit 4263068

Browse files
authored
[mlir][gpu] Clean GPU Passes.h from external SPIRV includes (#71331)
Removes the `SPIRVAttributes.h` header from `GPU/Transforms/Passes.h`
1 parent 7a62bee commit 4263068

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

mlir/include/mlir/Dialect/GPU/Transforms/Passes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "Utils.h"
1717
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
18-
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
1918
#include "mlir/Pass/Pass.h"
2019
#include <optional>
2120

mlir/include/mlir/Dialect/GPU/Transforms/Passes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def GpuSPIRVAttachTarget: Pass<"spirv-attach-target", ""> {
227227
/*default=*/ "\"Unknown\"",
228228
"Device Type">,
229229
Option<"deviceId", "device_id", "uint32_t",
230-
/*default=*/ "mlir::spirv::TargetEnvAttr::kUnknownDeviceID",
230+
/*default=*/ "",
231231
"Device ID">,
232232
];
233233
}

mlir/lib/Dialect/GPU/Transforms/SPIRVAttachTarget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ void SPIRVAttachTarget::runOnOperation() {
5757
auto deviceTypeSymbol = symbolizeDeviceType(deviceType);
5858
if (!deviceTypeSymbol)
5959
return signalPassFailure();
60+
// Set the default device ID if none was given
61+
if (!deviceId.hasValue())
62+
deviceId = mlir::spirv::TargetEnvAttr::kUnknownDeviceID;
6063

6164
Version version = versionSymbol.value();
6265
SmallVector<Capability, 4> capabilities;

mlir/test/Dialect/GPU/spirv-attach-targets.mlir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// RUN: mlir-opt %s --spirv-attach-target='module=spirv.* ver=v1.0 caps=Kernel' | FileCheck %s
2-
// RUN: mlir-opt %s --spirv-attach-target='module=spirv_warm.* ver=v1.0 caps=Kernel' | FileCheck %s --check-prefix=CHECK_WARM
1+
// RUN: mlir-opt %s --spirv-attach-target='module=spirv.* ver=v1.0 caps=Kernel vendor=Intel device_type=Other' | FileCheck %s
2+
// RUN: mlir-opt %s --spirv-attach-target='module=spirv_warm.* ver=v1.0 caps=Kernel vendor=Intel device_type=Other device_id=0' | FileCheck %s --check-prefix=CHECK_WARM
33

44
module attributes {gpu.container_module} {
5-
// CHECK: @spirv_hot_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
5+
// CHECK: @spirv_hot_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
66
// CHECK_WARM: @spirv_hot_module {
77
gpu.module @spirv_hot_module {
88
}
9-
// CHECK: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
10-
// CHECK_WARM: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
9+
// CHECK: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
10+
// CHECK_WARM: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other:0, #spirv.resource_limits<>>]
1111
gpu.module @spirv_warm_module {
1212
}
13-
// CHECK: @spirv_cold_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
13+
// CHECK: @spirv_cold_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
1414
// CHECK_WARM: @spirv_cold_module {
1515
gpu.module @spirv_cold_module {
1616
}

0 commit comments

Comments
 (0)