Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ std::string CalculateAccStr(const ShaderIndicesHelper* batch_dims, int64_t eleme

} // namespace

bool CanAutoSelectSubgroupGemm(std::string_view architecture) {
return architecture != gpu_arch::kGen12Hp;
}

bool CanApplySubgroup(const ComputeContext& context, int64_t M, int64_t N, int64_t K, bool transA, bool transB) {
if (context.AdapterInfo().vendor == std::string_view{"intel"}) {
bool use_subgroup = context.HasFeature(wgpu::FeatureName::Subgroups) &&
bool use_subgroup = CanAutoSelectSubgroupGemm(context.AdapterInfo().architecture) &&
context.HasFeature(wgpu::FeatureName::Subgroups) &&
M >= 64 && N >= 512 && K >= 32 && !transA && !transB;
return use_subgroup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ namespace webgpu {
namespace intel {

namespace gpu_arch {
inline constexpr std::string_view kGen12Hp = "gen-12hp";
inline constexpr std::string_view kXeLpg = "xe-lpg";
inline constexpr std::string_view kXe3Lpg = "xe-3lpg";
} // namespace gpu_arch

// Whether automatic algorithm selection may choose the subgroup GEMM/MatMul kernel on `architecture`.
bool CanAutoSelectSubgroupGemm(std::string_view architecture);

bool ShouldFoldMatMulSubgroupBatch(std::string_view architecture,
int64_t m,
bool can_fold_batch_into_m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <utility>

#include "core/providers/webgpu/vendor/intel/math/gemm_subgroup_utils.h"

namespace onnxruntime {
namespace webgpu {
namespace intel {
Expand All @@ -18,6 +20,7 @@ std::optional<MatMulAlgorithm> IntelMatMulExecutionPlanner::SelectVendorAlgorith
return MatMulAlgorithm::SubgroupMatrix;
}
if (params.has_subgroup_capability &&
CanAutoSelectSubgroupGemm(params.adapter_architecture) &&
params.m >= 64 && params.n >= 512 && params.k >= 32) {
return MatMulAlgorithm::Subgroup;
}
Expand Down
Loading