From ab851d21b58c2d4cfa6fbd81abf1606588a1d7f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20=C5=BDu=C5=BEek?= <peter@codeplay.com>
Date: Thu, 14 Mar 2024 15:52:16 +0100
Subject: [PATCH] [SYCL][E2E] Set CUDA_PATH at a later point (#12886)

This ensures `ext_oneapi_` has been removed first. There's also no need
to set `ROCM_PATH` twice.

This builds on top of https://github.com/intel/llvm/pull/12606
---
 sycl/test-e2e/lit.cfg.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py
index 869dce39a5a13..ca072b843d19f 100644
--- a/sycl/test-e2e/lit.cfg.py
+++ b/sycl/test-e2e/lit.cfg.py
@@ -80,12 +80,6 @@
 
 llvm_config.with_environment("PATH", config.lit_tools_dir, append_path=True)
 
-if "cuda:gpu" in config.sycl_devices:
-    llvm_config.with_system_environment("CUDA_PATH")
-
-if "hip:gpu" in config.sycl_devices:
-    llvm_config.with_system_environment("ROCM_PATH")
-
 # Configure LD_LIBRARY_PATH or corresponding os-specific alternatives
 if platform.system() == "Linux":
     config.available_features.add("linux")
@@ -456,6 +450,9 @@
         + ", ".join(supported_hip_platforms)
     )
 
+if "cuda:gpu" in config.sycl_devices:
+    llvm_config.with_system_environment("CUDA_PATH")
+
 # FIXME: This needs to be made per-device as well, possibly with a helper.
 if "hip:gpu" in config.sycl_devices and config.hip_platform == "AMD":
     llvm_config.with_system_environment("ROCM_PATH")