Skip to content

Commit

Permalink
SYCL: Fix AOT (AMReX-Codes#3155)
Browse files Browse the repository at this point in the history
This reverts part of AMReX-Codes#3123 because the AOT argument is a compile option.
Also we must provide AMReX_INTEL_ARCH when SYCL AOT is on.
  • Loading branch information
WeiqunZhang authored Feb 13, 2023
1 parent 774f544 commit e45a6a6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Docs/sphinx_documentation/source/GPU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Below is an example configuration for SYCL:
+==============================+=================================================+=============+=================+
| AMReX_SYCL_AOT | Enable SYCL ahead-of-time compilation | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | * | Gen9, etc. |
| AMREX_INTEL_ARCH | Specify target if AOT is enabled | None | pvc, etc. |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_SYCL_SPLIT_KERNEL | Enable SYCL kernel splitting | YES | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
Expand Down
8 changes: 6 additions & 2 deletions Tools/CMake/AMReXOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ cmake_dependent_option( AMReX_SYCL_ONEDPL "Enable Intel's oneDPL algorithms" OF
print_option( AMReX_SYCL_ONEDPL )

if (AMReX_SYCL)
set(AMReX_INTEL_ARCH_DEFAULT "*")
set(AMReX_INTEL_ARCH_DEFAULT "IGNORE")
if (DEFINED ENV{AMREX_INTEL_ARCH})
set(AMReX_INTEL_ARCH_DEFAULT "$ENV{AMREX_INTEL_ARCH}")
endif()

set(AMReX_INTEL_ARCH ${AMReX_INTEL_ARCH_DEFAULT} CACHE STRING
"INTEL GPU architecture")
"INTEL GPU architecture (Must be provided if AMReX_GPU_BACKEND=SYCL and AMReX_SYCL_AOT=ON)")

if (AMReX_SYCL_AOT AND NOT AMReX_INTEL_ARCH)
message(FATAL_ERROR "\nMust specify AMReX_INTEL_ARCH if AMReX_GPU_BACKEND=SYCL and AMReX_SYCL_AOT=ON\n")
endif()
endif ()

# --- HIP ----
Expand Down
5 changes: 5 additions & 0 deletions Tools/CMake/AMReXSYCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ target_link_options( SYCL


if (AMReX_SYCL_AOT)
target_compile_options( SYCL
INTERFACE
"$<${_cxx_sycl}:-fsycl-targets=spir64_gen>"
"$<${_cxx_sycl}:SHELL:-Xsycl-target-backend \"-device ${AMReX_INTEL_ARCH}\">" )

target_link_options( SYCL
INTERFACE
"$<${_cxx_sycl}:-fsycl-targets=spir64_gen>"
Expand Down
2 changes: 1 addition & 1 deletion Tools/GNUMake/comps/dpcpp.mak
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ifeq ($(SYCL_AOT),TRUE)
amrex_intel_gpu_target = *
$(info Because neither INTEL_ARCH nor AMREX_INTEL_ARCH is specified, AOT will be performed for all devices.)
endif
LDFLAGS += -fsycl-targets=spir64_gen -Xsycl-target-backend '-device $(amrex_intel_gpu_target)'
CXXFLAGS += -fsycl-targets=spir64_gen -Xsycl-target-backend '-device $(amrex_intel_gpu_target)'
endif

ifeq ($(DEBUG),TRUE)
Expand Down

0 comments on commit e45a6a6

Please sign in to comment.