diff --git a/slangtorch/slangtorch.py b/slangtorch/slangtorch.py index babab15..0cb44c4 100644 --- a/slangtorch/slangtorch.py +++ b/slangtorch/slangtorch.py @@ -357,7 +357,7 @@ def _compileSlang(metadata, fileName, targetMode, options, outputFile, includePa return {"options": options, "deps": deps, "version": versionCode, "includePaths": includePaths} -def compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir=None, verbose=False, dryRun=False, skipNinjaCheck=False, extraCudaFlags=[]): +def compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir=None, verbose=False, dryRun=False, skipNinjaCheck=False, extraCudaFlags=[], extraSyclFlags=[]): needsRebuild = False needsReload = False @@ -460,7 +460,7 @@ def compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir return True, None # Compile the module. - slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, extraCudaFlags, verbose) + slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, extraCudaFlags, extraSyclFlags, verbose) newMetadata = metadata.copy() newMetadata["moduleName"] = moduleName @@ -478,7 +478,7 @@ def compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir compileAndLoadModule._moduleCache = {} -def _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, extraCudaFlags=[], verbose=False): +def _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, extraCudaFlags=[], extraSyclFlags=[], verbose=False): # make sure to add cl.exe to PATH on windows so ninja can find it. _add_msvc_to_env_var() @@ -509,6 +509,7 @@ def _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDi sources, extra_cflags=extra_cflags, extra_cuda_cflags=extra_cuda_cflags if extra_cuda_cflags else None, + extra_sycl_cflags=extra_sycl_cflags if extra_sycl_cflags else None, extra_ldflags=None, extra_include_paths=extra_include_paths, build_directory=os.path.realpath(buildDir), @@ -516,7 +517,8 @@ def _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDi is_python_module=True, is_standalone=False, keep_intermediates=True, - with_cuda=None) + with_cuda=None, + with_sycl=None) def parseDepfile(depFile): diff --git a/slangtorch/util/compile.py b/slangtorch/util/compile.py index 7b75bf0..1d99b2b 100644 --- a/slangtorch/util/compile.py +++ b/slangtorch/util/compile.py @@ -29,11 +29,13 @@ def jit_compile(name, sources, extra_cflags, extra_cuda_cflags, + extra_sycl_cflags, extra_ldflags, extra_include_paths, build_directory: str, verbose: bool, with_cuda: Optional[bool], + with_sycl: Optional[bool], is_python_module, is_standalone, keep_intermediates=True) -> None: @@ -73,11 +75,13 @@ def jit_compile(name, sources=sources, extra_cflags=extra_cflags or [], extra_cuda_cflags=extra_cuda_cflags or [], + extra_sycl_cflags=extra_sycl_cflags or [], extra_ldflags=extra_ldflags or [], extra_include_paths=extra_include_paths or [], build_directory=build_directory, verbose=verbose, with_cuda=with_cuda, + with_cuda=with_sycl, is_standalone=is_standalone) finally: baton.release() @@ -153,4 +157,4 @@ def run_ninja( if verbose: print(e.stdout.decode()) print(e.stderr.decode()) - return NinjaResult.BUILD_FAIL \ No newline at end of file + return NinjaResult.BUILD_FAIL