Skip to content

Commit 3902b4a

Browse files
authored
Fast path mirroring oneDNN's mayiuse_microkernels to skip igc_check (openvinotoolkit#36697)
### Details: igc_check kernel build will be performed at the first time compilation for each session, and we can reuse the fast path in oneDNN https://github.com/uxlfoundation/oneDNN/blob/main/src/gpu/intel/compute/ukernels.cpp#L57 to skip the igc_check kernel build. It will save ~100ms first compilation time for each model. ### Tickets: - *CVS-190211* ### AI Assistance: - *AI assistance used: yes* - *AI is used to profile and test
1 parent e37f7af commit 3902b4a

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,37 @@ bool check_cm_jit_support(cldnn::engine& e, const cldnn::ExecutionConfig& config
127127
return cache.at(device);
128128
}
129129

130+
static bool parse_driver_version(const std::string& driver_version, size_t num_components, std::vector<int>& components) {
131+
components.assign(num_components, 0);
132+
const char* first = driver_version.data();
133+
const char* last = driver_version.data() + driver_version.size();
134+
for (size_t i = 0; i < num_components; i++) {
135+
auto [ptr, ec] = std::from_chars(first, last, components[i]);
136+
if (ec != std::errc())
137+
return false;
138+
if (i + 1 < num_components) {
139+
// Expect a '.' separator before the next component
140+
if (ptr == last || *ptr != '.')
141+
return false;
142+
first = ptr + 1;
143+
}
144+
}
145+
return true;
146+
}
147+
148+
static bool driver_version_supports_microkernels(const std::string& driver_version) {
149+
std::vector<int> v;
150+
#ifdef _WIN32
151+
if (!parse_driver_version(driver_version, 4, v))
152+
return false;
153+
return std::tie(v[0], v[1], v[2], v[3]) >= std::make_tuple(31, 0, 101, 6987);
154+
#else
155+
if (!parse_driver_version(driver_version, 3, v))
156+
return false;
157+
return std::tie(v[0], v[1], v[2]) >= std::make_tuple(24, 22, 29735);
158+
#endif
159+
}
160+
130161
bool query_microkernels_supported(cldnn::engine& e, const cldnn::ExecutionConfig& config) {
131162
auto device = e.get_device().get();
132163

@@ -137,6 +168,13 @@ bool query_microkernels_supported(cldnn::engine& e, const cldnn::ExecutionConfig
137168
return cache.at(device);
138169
}
139170

171+
// Fast path mirroring oneDNN's mayiuse_microkernels(): when the driver runtime version is
172+
// known to support microkernels, skip building the igc_check probe kernel.
173+
if (driver_version_supports_microkernels(e.get_device_info().driver_version)) {
174+
cache[device] = true;
175+
return true;
176+
}
177+
140178
std::shared_ptr<kernel_selector::KernelString> kernel_string = std::make_shared<kernel_selector::KernelString>();
141179
// This program check that all required vISA features are supported by current IGC version
142180
const char* kernel_code = R""""(

0 commit comments

Comments
 (0)