Skip to content

Commit

Permalink
Go back to old Heuristic but ask for more bestKElementCountPerSubgroup
Browse files Browse the repository at this point in the history
Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
  • Loading branch information
nirvedhmeshram committed Jan 10, 2025
1 parent b3f2c11 commit fe2b43e
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static std::optional<GPUMMASchedule> getMmaScheduleFromProblemAndTarget(
GPUMMAHeuristicSeeds seeds;
assert(problem.aType == problem.bType &&
"expected the same aType and bType.");
int64_t inBitWidth = problem.aType.getIntOrFloatBitWidth();

// Note that the following heuristic seeds are just placeholder values.
// We need to clean it up and make it adjusting to different targets.
Expand All @@ -147,14 +148,23 @@ static std::optional<GPUMMASchedule> getMmaScheduleFromProblemAndTarget(
// and a larger bestKTileCountPerSubgroup.
seeds = {/*bestSubgroupCountPerWorkgroup=*/4,
/*bestMNTileCountPerSubgroup=*/4,
/*bestKTileCountPerSubgroup=*/8};
/*bestKTileCountPerSubgroup=*/8,
/*bestKElementCountPerSubgroup*/ kCacheLineSizeBits * 4 /
inBitWidth};
} else {
seeds = {/*bestSubgroupCountPerWorkgroup=*/4,
/*bestMNTileCountPerSubgroup=*/8,
/*bestKTileCountPerSubgroup=*/4};
}

int64_t maxSharedMemoryBytes = target.getWgp().getMaxWorkgroupMemoryBytes();
/*bestMNTileCountPerSubgroup=*/16,
/*bestKTileCountPerSubgroup=*/4,
/*bestKElementCountPerSubgroup*/ kCacheLineSizeBits * 2 /
inBitWidth};
}

// We target slightly below the full available shared Memory to leave room for
// `GPUReduceBankConflictsPass` that will pad shared memory without keeping
// track of usage. We can drop this after fixing
// https://github.com/iree-org/iree/issues/19675
int64_t maxSharedMemoryBytes =
target.getWgp().getMaxWorkgroupMemoryBytes() - 64 * inBitWidth;

// First try to find a schedule with an exactly matching intrinsic.
std::optional<GPUMMASchedule> schedule = deduceMMASchedule(
Expand Down

0 comments on commit fe2b43e

Please sign in to comment.