Skip to content

Commit

Permalink
Revert "[SPIRV] Reduce the number of warps used by subgroup reduce"
Browse files Browse the repository at this point in the history
This reverts commit 31e7635.
  • Loading branch information
monorimet authored and github-actions[bot] committed Aug 30, 2023
1 parent d2d37b9 commit 974c895
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions compiler/src/iree/compiler/Codegen/SPIRV/KernelConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ using llvm::APIntOps::GreatestCommonDivisor;
constexpr unsigned numTilesPerSubgroupDimK = 2;

constexpr int kMaxVectorNumBits = 128;
constexpr int kPreferredReductionVectorUnrollAmount = 8;

namespace mlir {
namespace iree_compiler {
Expand Down Expand Up @@ -1281,8 +1280,7 @@ static LogicalResult setReductionConfig(const spirv::TargetEnv &targetEnv,
return failure();

// Let each thread handle `vectorSize` elements.
unsigned vectorSize =
kPreferredReductionVectorUnrollAmount * kMaxVectorNumBits / bitWidth;
unsigned vectorSize = kMaxVectorNumBits / bitWidth;
while ((dimSize / vectorSize) % subgroupSize != 0)
vectorSize /= 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ hal.executable @i4_dequant_matvec_f32 {
// CHECK-DAG: #[[$TRANSLATION:.+]] = #iree_codegen.translation_info<SPIRVSubgroupReduce>
// CHECK-LABEL: hal.executable.export public @i4_dequant_matvec_f32
// CHECK-SAME: translation_info = #[[$TRANSLATION]]
// CHECK-SAME: workgroup_size = [128 : index, 1 : index, 1 : index]
// CHECK-SAME: workgroup_size = [1024 : index, 1 : index, 1 : index]
// CHECK: func.func @i4_dequant_matvec_f32()
// CHECK: linalg.generic
// CHECK-SAME: lowering_config = #[[$CONFIG]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ hal.executable private @subgroup_reduce_f32 {
// CHECK-DAG: #[[TRANSLATION:.+]] = #iree_codegen.translation_info<SPIRVSubgroupReduce>
// CHECK: hal.executable.export public @subgroup_reduce_f32
// CHECK-SAME: translation_info = #[[TRANSLATION]]
// CHECK-SAME: workgroup_size = [16 : index, 1 : index, 1 : index]
// CHECK-SAME: workgroup_size = [128 : index, 1 : index, 1 : index]
// CHECK: func.func @subgroup_reduce_f32()
// CHECK: linalg.generic
// CHECK-SAME: lowering_config = #[[CONFIG]]
Expand Down Expand Up @@ -105,7 +105,7 @@ hal.executable private @subgroup_reduce_f16 {
// CHECK-DAG: #[[TRANSLATION:.+]] = #iree_codegen.translation_info<SPIRVSubgroupReduce>
// CHECK: hal.executable.export public @subgroup_reduce_f16
// CHECK-SAME: translation_info = #[[TRANSLATION]]
// CHECK-SAME: workgroup_size = [64 : index, 1 : index, 1 : index]
// CHECK-SAME: workgroup_size = [512 : index, 1 : index, 1 : index]
// CHECK: func.func @subgroup_reduce_f16()
// CHECK: linalg.generic
// CHECK-SAME: lowering_config = #[[CONFIG]]

0 comments on commit 974c895

Please sign in to comment.