Skip to content

Commit

Permalink
[UR][L0] Make urPlatformGetBackendOption return -ze-opt-level=2 for -…
Browse files Browse the repository at this point in the history
…O1 and -O2 (intel#12023)

oneapi-src/unified-runtime#1129

---------

Signed-off-by: Sarnie, Nick <[email protected]>
Co-authored-by: Kenneth Benzie (Benie) <[email protected]>
  • Loading branch information
sarnex and kbenzie authored Jan 10, 2024
1 parent b32db9a commit d3a5f1d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions sycl/doc/design/PropagateCompilerFlagsToRuntime.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ OpenCL backends.
| Front-end option | L0 backend option | OpenCL backend option |
| ---------------- | ----------------- | --------------------- |
| -O0 | -ze-opt-disable | -cl-opt-disable |
| -O1 | -ze-opt-level=1 | /* no option */ |
| -O2 | -ze-opt-level=1 | /* no option */ |
| -O1 | -ze-opt-level=2 | /* no option */ |
| -O2 | -ze-opt-level=2 | /* no option */ |
| -O3 | -ze-opt-level=2 | /* no option */ |


Expand Down
3 changes: 1 addition & 2 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ pi_result piPluginGetLastError(char **message) {

// Returns plugin specific backend option.
// Return '-ze-opt-disable' for frontend_option = -O0.
// Return '-ze-opt-level=1' for frontend_option = -O1 or -O2.
// Return '-ze-opt-level=2' for frontend_option = -O3.
// Return '-ze-opt-level=2' for frontend_option = -O1, O2 or -O3.
// Return '-igc_opts 'PartitionUnit=1,SubroutineThreshold=50000'' for
// frontend_option = -ftarget-compile-fast.
pi_result piPluginGetBackendOption(pi_platform platform,
Expand Down
12 changes: 6 additions & 6 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit 12a67f56c3c5d08cfac0852d552b4e5fe0452d04
# Merge: 2b7b827c c10968f5
# commit c2d78257ba7e7bbc230333f291282d16145aaac7
# Merge: 8bb539c5 b3a1d52d
# Author: Kenneth Benzie (Benie) <[email protected]>
# Date: Tue Jan 9 10:53:32 2024 +0000
# Merge pull request #1027 from GeorgeWeb/georgi/hip_memadvise
# [SYCL][HIP] Implement mem_advise for HIP
set(UNIFIED_RUNTIME_TAG 12a67f56c3c5d08cfac0852d552b4e5fe0452d04)
# Date: Wed Jan 10 11:24:12 2024 +0000
# Merge pull request #1129 from sarnex/adapters
# [UR][L0] Make urPlatformGetBackendOption return -ze-opt-level=2 for -O1 and -O2
set(UNIFIED_RUNTIME_TAG c2d78257ba7e7bbc230333f291282d16145aaac7)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
// RUN: %{build} -O1 -o %t1.out
// RUN: env SYCL_PI_TRACE=-1 %{run} %t1.out 2>&1 | FileCheck %s --check-prefixes=CHECK1
// RUN: %{build} -O2 -o %t2.out
// RUN: env SYCL_PI_TRACE=-1 %{run} %t2.out 2>&1 | FileCheck %s --check-prefixes=CHECK2
// RUN: env SYCL_PI_TRACE=-1 %{run} %t2.out 2>&1 | FileCheck %s --check-prefixes=CHECK1
// RUN: %{build} -O3 -o %t3.out
// RUN: env SYCL_PI_TRACE=-1 %{run} %t3.out 2>&1 | FileCheck %s --check-prefixes=CHECK3
// RUN: env SYCL_PI_TRACE=-1 %{run} %t3.out 2>&1 | FileCheck %s --check-prefixes=CHECK1

// This test verifies the propagation of front-end compiler optimization
// option to the backend.
// API call in device code:
// Following is expected addition of options for level_zero backend:
// Front-end option | L0 backend option
// -O0 | -ze-opt-disable
// -O1 | -ze-opt-level=1
// -O2 | -ze-opt-level=1
// -O1 | -ze-opt-level=2
// -O2 | -ze-opt-level=2
// -O3 | -ze-opt-level=2

#include <sycl/sycl.hpp>
Expand All @@ -30,7 +30,5 @@ int main() {

// CHECK-LABEL: ---> piProgramBuild(
// CHECK0: -ze-opt-disable
// CHECK1: -ze-opt-level=1
// CHECK2: -ze-opt-level=1
// CHECK3: -ze-opt-level=2
// CHECK1: -ze-opt-level=2
// CHECK: ) ---> pi_result : PI_SUCCESS

0 comments on commit d3a5f1d

Please sign in to comment.