| ceed-hip-compile.cpp (1f70653f2b6c0ef3909d0fb12b83efaa0f81e309) | ceed-hip-compile.cpp (a4bfdec2fbbaf1320f707b4acef5a9f16daff0b4) |
|---|---|
| 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include "ceed-hip-compile.h" --- 66 unchanged lines hidden (view full) --- 75 va_end(args); 76 } 77 78 // Standard libCEED definitions for HIP backends 79 CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/hip/hip-jit.h", &jit_defs_path)); 80 CeedCallBackend(CeedLoadSourceToBuffer(ceed, jit_defs_path, &jit_defs_source)); 81 code << jit_defs_source; 82 code << "\n\n"; | 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include "ceed-hip-compile.h" --- 66 unchanged lines hidden (view full) --- 75 va_end(args); 76 } 77 78 // Standard libCEED definitions for HIP backends 79 CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/hip/hip-jit.h", &jit_defs_path)); 80 CeedCallBackend(CeedLoadSourceToBuffer(ceed, jit_defs_path, &jit_defs_source)); 81 code << jit_defs_source; 82 code << "\n\n"; |
| 83 CeedCallBackend(CeedFree(&jit_defs_path)); 84 CeedCallBackend(CeedFree(&jit_defs_source)); | |
| 85 86 // Non-macro options 87 opts[0] = "-default-device"; 88 CeedCallBackend(CeedGetData(ceed, (void **)&ceed_data)); 89 CeedCallHip(ceed, hipGetDeviceProperties(&prop, ceed_data->device_id)); 90 std::string arch_arg = "--gpu-architecture=" + std::string(prop.gcnArchName); 91 opts[1] = arch_arg.c_str(); 92 opts[2] = "-munsafe-fp-atomics"; --- 6 unchanged lines hidden (view full) --- 99 100 // Compile kernel 101 hiprtcResult result = hiprtcCompileProgram(prog, num_opts, opts); 102 103 if (result != HIPRTC_SUCCESS) { 104 size_t log_size; 105 char *log; 106 | 83 84 // Non-macro options 85 opts[0] = "-default-device"; 86 CeedCallBackend(CeedGetData(ceed, (void **)&ceed_data)); 87 CeedCallHip(ceed, hipGetDeviceProperties(&prop, ceed_data->device_id)); 88 std::string arch_arg = "--gpu-architecture=" + std::string(prop.gcnArchName); 89 opts[1] = arch_arg.c_str(); 90 opts[2] = "-munsafe-fp-atomics"; --- 6 unchanged lines hidden (view full) --- 97 98 // Compile kernel 99 hiprtcResult result = hiprtcCompileProgram(prog, num_opts, opts); 100 101 if (result != HIPRTC_SUCCESS) { 102 size_t log_size; 103 char *log; 104 |
| 105 CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n"); 106 CeedDebug(ceed, "File: %s\n", jit_defs_path); 107 CeedDebug(ceed, "Source:\n%s\n", jit_defs_source); 108 CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n"); 109 CeedCallBackend(CeedFree(&jit_defs_path)); 110 CeedCallBackend(CeedFree(&jit_defs_source)); |
|
| 107 CeedChk_hiprtc(ceed, hiprtcGetProgramLogSize(prog, &log_size)); 108 CeedCallBackend(CeedMalloc(log_size, &log)); 109 CeedCallHiprtc(ceed, hiprtcGetProgramLog(prog, log)); 110 return CeedError(ceed, CEED_ERROR_BACKEND, "%s\n%s", hiprtcGetErrorString(result), log); 111 } | 111 CeedChk_hiprtc(ceed, hiprtcGetProgramLogSize(prog, &log_size)); 112 CeedCallBackend(CeedMalloc(log_size, &log)); 113 CeedCallHiprtc(ceed, hiprtcGetProgramLog(prog, log)); 114 return CeedError(ceed, CEED_ERROR_BACKEND, "%s\n%s", hiprtcGetErrorString(result), log); 115 } |
| 116 CeedCallBackend(CeedFree(&jit_defs_path)); 117 CeedCallBackend(CeedFree(&jit_defs_source)); |
|
| 112 113 CeedCallHiprtc(ceed, hiprtcGetCodeSize(prog, &ptx_size)); 114 CeedCallBackend(CeedMalloc(ptx_size, &ptx)); 115 CeedCallHiprtc(ceed, hiprtcGetCode(prog, ptx)); 116 CeedCallHiprtc(ceed, hiprtcDestroyProgram(&prog)); 117 118 CeedCallHip(ceed, hipModuleLoadData(module, ptx)); 119 CeedCallBackend(CeedFree(&ptx)); --- 38 unchanged lines hidden --- | 118 119 CeedCallHiprtc(ceed, hiprtcGetCodeSize(prog, &ptx_size)); 120 CeedCallBackend(CeedMalloc(ptx_size, &ptx)); 121 CeedCallHiprtc(ceed, hiprtcGetCode(prog, ptx)); 122 CeedCallHiprtc(ceed, hiprtcDestroyProgram(&prog)); 123 124 CeedCallHip(ceed, hipModuleLoadData(module, ptx)); 125 CeedCallBackend(CeedFree(&ptx)); --- 38 unchanged lines hidden --- |