From b46856d99a30a91236b8044430107af96d2043d2 Mon Sep 17 00:00:00 2001 From: MoFtZ Date: Mon, 22 Jan 2024 20:52:19 +1100 Subject: [PATCH] Updated pre-generated LibDevice to use Cuda SDK v8. --- Src/ILGPU/Backends/PTX/PTXLibDevice.cs | 2 +- Src/ILGPU/Runtime/Cuda/NvvmAPI.cs | 23 +- Src/ILGPU/Static/CudaLibDevicePtx.xml | 640 ++++++++++++------------- 3 files changed, 336 insertions(+), 329 deletions(-) diff --git a/Src/ILGPU/Backends/PTX/PTXLibDevice.cs b/Src/ILGPU/Backends/PTX/PTXLibDevice.cs index 2a62cc0634..cf900c1eba 100644 --- a/Src/ILGPU/Backends/PTX/PTXLibDevice.cs +++ b/Src/ILGPU/Backends/PTX/PTXLibDevice.cs @@ -59,7 +59,7 @@ public static void FindLibDevicePaths( nvvmBinDir = Path.Combine(nvvmRoot, nvvmBinName); var nvvmSearchPattern = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? "nvvm*.dll" + ? "nvvm64*.dll" : "libnvvm*.so"; var nvvmFiles = Directory.EnumerateFiles(nvvmBinDir, nvvmSearchPattern); libNvvmPath = nvvmFiles.FirstOrDefault(); diff --git a/Src/ILGPU/Runtime/Cuda/NvvmAPI.cs b/Src/ILGPU/Runtime/Cuda/NvvmAPI.cs index be4e258cc9..b7b9f689f8 100644 --- a/Src/ILGPU/Runtime/Cuda/NvvmAPI.cs +++ b/Src/ILGPU/Runtime/Cuda/NvvmAPI.cs @@ -1,6 +1,6 @@ // --------------------------------------------------------------------------------------- // ILGPU -// Copyright (c) 2021-2023 ILGPU Project +// Copyright (c) 2021-2024 ILGPU Project // www.ilgpu.net // // File: NvvmAPI.cs @@ -138,7 +138,7 @@ public static NvvmAPI Create(string libNvvmPath, string libDevicePath) => private readonly NvvmCreateProgram nvvmCreateProgram; private readonly NvvmDestroyProgram nvvmDestroyProgram; private readonly NvvmAddModuleToProgram nvvmAddModuleToProgram; - private readonly NvvmLazyAddModuleToProgram nvvmLazyAddModuleToProgram; + private readonly NvvmLazyAddModuleToProgram? nvvmLazyAddModuleToProgram; private readonly NvvmCompileProgram nvvmCompileProgram; private readonly NvvmVerifyProgram nvvmVerifyProgram; private readonly NvvmGetCompiledResultSize nvvmGetCompiledResultSize; @@ -183,11 +183,6 @@ private NvvmAPI(string libNvvmPath, string libDevicePath) NativeLibrary.GetExport( libNvvmModule, "nvvmAddModuleToProgram")); - nvvmLazyAddModuleToProgram = - Marshal.GetDelegateForFunctionPointer( - NativeLibrary.GetExport( - libNvvmModule, - "nvvmLazyAddModuleToProgram")); nvvmCompileProgram = Marshal.GetDelegateForFunctionPointer( NativeLibrary.GetExport( @@ -218,6 +213,16 @@ private NvvmAPI(string libNvvmPath, string libDevicePath) NativeLibrary.GetExport( libNvvmModule, "nvvmGetProgramLog")); + + if (NativeLibrary.TryGetExport( + libNvvmModule, + "nvvmLazyAddModuleToProgram", + out var nvvmLazyAddModuleToProgramPtr)) + { + nvvmLazyAddModuleToProgram = + Marshal.GetDelegateForFunctionPointer( + nvvmLazyAddModuleToProgramPtr); + } } /// @@ -311,7 +316,9 @@ public NvvmResult LazyAddModuleToProgram( IntPtr buffer, IntPtr size, string? name) => - nvvmLazyAddModuleToProgram(program, buffer, size, name); + nvvmLazyAddModuleToProgram != null + ? nvvmLazyAddModuleToProgram(program, buffer, size, name) + : nvvmAddModuleToProgram(program, buffer, size, name); /// /// Compiles the program. diff --git a/Src/ILGPU/Static/CudaLibDevicePtx.xml b/Src/ILGPU/Static/CudaLibDevicePtx.xml index 6acf526b3a..7e4fd1ff03 100644 --- a/Src/ILGPU/Static/CudaLibDevicePtx.xml +++ b/Src/ILGPU/Static/CudaLibDevicePtx.xml @@ -1,322 +1,322 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file