Skip to content

Commit 21d8d08

Browse files
committed
[SYCL] Add -f-offload-fp32-prec-[div/sqrt] FE option handling in JIT
It matches -cl-fp32-correctly-rounded-divide-[div/sqrt] option for OpenCL and -ze-fp32-correctly-rounded-divide-[div/sqrt] for L0. Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
1 parent 2eae687 commit 21d8d08

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

source/adapters/cuda/platform.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption(
168168
*ppPlatformOption = "";
169169
return UR_RESULT_SUCCESS;
170170
}
171+
if (pFrontendOption == "-foffload-fp32-prec-div" ||
172+
pFrontendOption == "-foffload-fp32-prec-sqrt") {
173+
*ppPlatformOption = "";
174+
return UR_RESULT_SUCCESS;
175+
}
171176
return UR_RESULT_ERROR_INVALID_VALUE;
172177
}

source/adapters/hip/platform.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,10 @@ urPlatformGetBackendOption(ur_platform_handle_t, const char *pFrontendOption,
154154
*ppPlatformOption = "";
155155
return UR_RESULT_SUCCESS;
156156
}
157+
if (pFrontendOption == "-foffload-fp32-prec-div" ||
158+
pFrontendOption == "-foffload-fp32-prec-sqrt") {
159+
*ppPlatformOption = "";
160+
return UR_RESULT_SUCCESS;
161+
}
157162
return UR_RESULT_ERROR_INVALID_VALUE;
158163
}

source/adapters/level_zero/platform.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ ur_result_t urPlatformGetBackendOption(
196196
*PlatformOption = "-igc_opts 'PartitionUnit=1,SubroutineThreshold=50000'";
197197
return UR_RESULT_SUCCESS;
198198
}
199+
if (pFrontendOption == "-foffload-fp32-prec-div") {
200+
*ppPlatformOption = "-ze-fp32-correctly-rounded-divide-div";
201+
return UR_RESULT_SUCCESS;
202+
}
203+
if (pFrontendOption == "-foffload-fp32-prec-sqrt") {
204+
*ppPlatformOption = "-ze-fp32-correctly-rounded-divide-sqrt";
205+
return UR_RESULT_SUCCESS;
206+
}
199207
return UR_RESULT_ERROR_INVALID_VALUE;
200208
}
201209

source/adapters/opencl/platform.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,13 @@ urPlatformGetBackendOption(ur_platform_handle_t, const char *pFrontendOption,
144144
*ppPlatformOption = "-igc_opts 'PartitionUnit=1,SubroutineThreshold=50000'";
145145
return UR_RESULT_SUCCESS;
146146
}
147+
if (pFrontendOption == "-foffload-fp32-prec-div") {
148+
*ppPlatformOption = "-cl-fp32-correctly-rounded-divide-div";
149+
return UR_RESULT_SUCCESS;
150+
}
151+
if (pFrontendOption == "-foffload-fp32-prec-sqrt") {
152+
*ppPlatformOption = "-cl-fp32-correctly-rounded-divide-sqrt";
153+
return UR_RESULT_SUCCESS;
154+
}
147155
return UR_RESULT_ERROR_INVALID_VALUE;
148156
}

0 commit comments

Comments
 (0)