From 0a8086e9194128211507473c19e3d30e8959967d Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 27 Jun 2022 18:02:15 -0700 Subject: [PATCH] Support using a custom value for occupancy limit accross all kernels --- example/optsched-cfg/sched.ini | 1 + include/opt-sched/Scheduler/defines.h | 2 ++ lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp | 2 ++ lib/Wrapper/OptimizingScheduler.cpp | 2 ++ 4 files changed, 7 insertions(+) diff --git a/example/optsched-cfg/sched.ini b/example/optsched-cfg/sched.ini index 316d553a..4b78ab28 100644 --- a/example/optsched-cfg/sched.ini +++ b/example/optsched-cfg/sched.ini @@ -341,6 +341,7 @@ SHOULD_LIMIT_OCCUPANCY YES # What should we use to limit the occupancy? # HEURISTIC: AMD's memory boundedness heuristic +# VALUE: Uses the value provided by OCCUPANCY_LIMIT for all kernels # FILE: occupancy_limits.ini file # NONE: do not use limits -- defaults to unlimited OCCUPANCY_LIMIT_SOURCE FILE diff --git a/include/opt-sched/Scheduler/defines.h b/include/opt-sched/Scheduler/defines.h index 34e31f72..24b06e0b 100644 --- a/include/opt-sched/Scheduler/defines.h +++ b/include/opt-sched/Scheduler/defines.h @@ -49,6 +49,8 @@ enum FUNC_RESULT { enum OCC_LIMIT_TYPE { // NONE OLT_NONE, + // Value provided by sched.ini + OLT_VALUE, // AMD's Heuristic OLT_HEUR, // Hardcoded File diff --git a/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp b/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp index e7b82972..1484d6e4 100644 --- a/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp +++ b/lib/Wrapper/AMDGPU/OptSchedGCNTarget.cpp @@ -222,6 +222,8 @@ int OptSchedGCNTarget::getOccupancyLimit(Config &OccFile) const { switch (LimitType) { case OLT_NONE: return OCCUnlimited; + case OLT_VALUE: + return OccupancyLimit; case OLT_HEUR: return MFI->isMemoryBound() || MFI->needsWaveLimiter() ? 4 : OCCUnlimited; case OLT_FILE: diff --git a/lib/Wrapper/OptimizingScheduler.cpp b/lib/Wrapper/OptimizingScheduler.cpp index fbf38a95..47183973 100644 --- a/lib/Wrapper/OptimizingScheduler.cpp +++ b/lib/Wrapper/OptimizingScheduler.cpp @@ -860,6 +860,8 @@ ScheduleDAGOptSched::parseOccLimit(const std::string Str) { if (Str == "NONE") { return OCC_LIMIT_TYPE::OLT_NONE; + } else if (Str = "VALUE") { + return OCC_LIMIT_TYPE::OLT_VALUE; } else if (Str == "HEURISTIC") { return OCC_LIMIT_TYPE::OLT_HEUR; } else if (Str == "FILE") {