Skip to content

[mlir][gpu] Clean GPU Passes.h from external SPIRV includes #71331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "Utils.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Pass/Pass.h"
#include <optional>

Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def GpuSPIRVAttachTarget: Pass<"spirv-attach-target", ""> {
/*default=*/ "\"Unknown\"",
"Device Type">,
Option<"deviceId", "device_id", "uint32_t",
/*default=*/ "mlir::spirv::TargetEnvAttr::kUnknownDeviceID",
/*default=*/ "",
"Device ID">,
];
}
Expand Down
3 changes: 3 additions & 0 deletions mlir/lib/Dialect/GPU/Transforms/SPIRVAttachTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void SPIRVAttachTarget::runOnOperation() {
auto deviceTypeSymbol = symbolizeDeviceType(deviceType);
if (!deviceTypeSymbol)
return signalPassFailure();
// Set the default device ID if none was given
if (!deviceId.hasValue())
deviceId = mlir::spirv::TargetEnvAttr::kUnknownDeviceID;

Version version = versionSymbol.value();
SmallVector<Capability, 4> capabilities;
Expand Down
12 changes: 6 additions & 6 deletions mlir/test/Dialect/GPU/spirv-attach-targets.mlir
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// RUN: mlir-opt %s --spirv-attach-target='module=spirv.* ver=v1.0 caps=Kernel' | FileCheck %s
// RUN: mlir-opt %s --spirv-attach-target='module=spirv_warm.* ver=v1.0 caps=Kernel' | FileCheck %s --check-prefix=CHECK_WARM
// RUN: mlir-opt %s --spirv-attach-target='module=spirv.* ver=v1.0 caps=Kernel vendor=Intel device_type=Other' | FileCheck %s
// 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

module attributes {gpu.container_module} {
// CHECK: @spirv_hot_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
// CHECK: @spirv_hot_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
// CHECK_WARM: @spirv_hot_module {
gpu.module @spirv_hot_module {
}
// CHECK: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
// CHECK_WARM: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
// CHECK: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
// CHECK_WARM: @spirv_warm_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other:0, #spirv.resource_limits<>>]
gpu.module @spirv_warm_module {
}
// CHECK: @spirv_cold_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, #spirv.resource_limits<>>]
// CHECK: @spirv_cold_module [#spirv.target_env<#spirv.vce<v1.0, [Kernel], []>, Intel:Other, #spirv.resource_limits<>>]
// CHECK_WARM: @spirv_cold_module {
gpu.module @spirv_cold_module {
}
Expand Down