Skip to content
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
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/Rock/IR/RockAttrDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def Rock_GeneralGemmParamsAttr : Rock_Attr<"GeneralGemmParams", [RockTuningParam

let extraClassDeclaration = [{
void getPerfConfigStr(::llvm::SmallVectorImpl<char> &perfStr) {
("v4:" + Twine(getBlockSize()) + ","
("v3:" + Twine(getBlockSize()) + ","
+ Twine(getMPerBlock()) + ","
+ Twine(getNPerBlock()) + ","
+ Twine(getKPerBlock()) + ","
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/rocmlir-gen/emit-tuning-space.mlir
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: rocmlir-gen -p --arch gfx1100 --operation=gemm --emit-tuning-space=full | FileCheck %s --check-prefixes=CHECK-NAVI
// CHECK-NAVI: v4:64,32,32,4,2,4,1,1,2
// CHECK-NAVI: v3:64,32,32,4,2,4,1,1,2

// RUN: rocmlir-gen --arch gfx90a --operation=gemm -t f32 -g 1 -m 64 -k 128 -n 64 --num_cu=104 --emit-tuning-space=full | FileCheck %s --check-prefixes=CHECK-MI
// CHECK-MI: v4:64,64,8,32,32,16,4,4,1,2,1,1
Expand Down
1 change: 1 addition & 0 deletions mlir/unittests/Dialect/Rock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(ROCK_UNITTEST_SOURCES
loweringUtilsTests.cpp
transformMapUtilsTests.cpp
InitParamsAccelTests.cpp
InitParamsNonAccelTests.cpp
)

if(NOT WIN32)
Expand Down
84 changes: 84 additions & 0 deletions mlir/unittests/Dialect/Rock/InitParamsNonAccelTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//===- InitParamsNonAccelTests.cpp - Tests for InitParamsNonAccel
//--------------===//
Comment on lines +1 to +2
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment header is split across two lines which is inconsistent with the formatting used in InitParamsAccelTests.cpp. The entire header should be on a single line like:

//===- InitParamsNonAccelTests.cpp - Tests for InitParamsNonAccel -------===//
Suggested change
//===- InitParamsNonAccelTests.cpp - Tests for InitParamsNonAccel
//--------------===//
//===- InitParamsNonAccelTests.cpp - Tests for InitParamsNonAccel -------===//

Copilot uses AI. Check for mistakes.
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir/Dialect/Rock/Tuning/GridwiseGemmParams.h"
#include "gtest/gtest.h"

using namespace mlir;
using namespace mlir::rock;

namespace {

//===----------------------------------------------------------------------===//
// v3 perfconfig
//===----------------------------------------------------------------------===//

TEST(V3Config, First) {
InitParamsNonAccel validParams;
bool isValidPerfConfig = validParams.deserialize("v3:64,32,32,4,2,4,1,1,2");

EXPECT_EQ(isValidPerfConfig, true);
EXPECT_EQ(validParams.blockSize, static_cast<uint32_t>(64));
EXPECT_EQ(validParams.gemmMPerBlock, 32);
EXPECT_EQ(validParams.gemmNPerBlock, 32);
EXPECT_EQ(validParams.gemmKPerBlock, 4);
EXPECT_EQ(validParams.gemmMPerThread, 2);
EXPECT_EQ(validParams.gemmNPerThread, 4);
EXPECT_EQ(validParams.splitKFactor, 1);
EXPECT_EQ(validParams.gemmScheduleVersion, 1);
EXPECT_EQ(validParams.outputSwizzle, 2);
EXPECT_EQ(validParams.getKPack(), 1);
EXPECT_EQ(validParams.getVersion(), InitParamsNonAccel::Version::V3);
}

TEST(V3Config, Second) {
InitParamsNonAccel validParams;
bool isValidPerfConfig = validParams.deserialize("v3:128,64,32,8,4,2,3,1,2");

EXPECT_EQ(isValidPerfConfig, true);
EXPECT_EQ(validParams.blockSize, static_cast<uint32_t>(128));
EXPECT_EQ(validParams.gemmMPerBlock, 64);
EXPECT_EQ(validParams.gemmNPerBlock, 32);
EXPECT_EQ(validParams.gemmKPerBlock, 8);
EXPECT_EQ(validParams.gemmMPerThread, 4);
EXPECT_EQ(validParams.gemmNPerThread, 2);
EXPECT_EQ(validParams.splitKFactor, 3);
EXPECT_EQ(validParams.gemmScheduleVersion, 1);
EXPECT_EQ(validParams.outputSwizzle, 2);
EXPECT_EQ(validParams.getKPack(), 1);
EXPECT_EQ(validParams.getVersion(), InitParamsNonAccel::Version::V3);
}

//===----------------------------------------------------------------------===//
// Negative Tests
//===----------------------------------------------------------------------===//

TEST(NegativeTests, NoVersion) {
InitParamsNonAccel validParams;
bool isValidPerfConfig =
validParams.deserialize("128,64,8,64,32,4,9,2,2,0,1");

EXPECT_EQ(isValidPerfConfig, false);
}

TEST(NegativeTests, WrongNumberV3) {
InitParamsNonAccel validParams;
bool isValidPerfConfig = validParams.deserialize("v3:64,32,32,4,2,4,1,1");

EXPECT_EQ(isValidPerfConfig, false);
}

TEST(NegativeTests, Empty) {
InitParamsNonAccel validParams;
bool isValidPerfConfig = validParams.deserialize("");

EXPECT_EQ(isValidPerfConfig, false);
}

} // end anonymous namespace