Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/hip/device_impl.cpp
| Show All 18 Lines | |||||
| # include <climits> | # include <climits> | ||||
| # include <limits.h> | # include <limits.h> | ||||
| # include <stdio.h> | # include <stdio.h> | ||||
| # include <stdlib.h> | # include <stdlib.h> | ||||
| # include <string.h> | # include <string.h> | ||||
| # include "device/hip/device_impl.h" | # include "device/hip/device_impl.h" | ||||
| # include "render/buffers.h" | # include "util/debug.h" | ||||
| # include "util/foreach.h" | |||||
| # include "util/util_debug.h" | # include "util/log.h" | ||||
| # include "util/util_foreach.h" | # include "util/map.h" | ||||
| # include "util/util_logging.h" | # include "util/md5.h" | ||||
| # include "util/util_map.h" | # include "util/opengl.h" | ||||
| # include "util/util_md5.h" | # include "util/path.h" | ||||
| # include "util/util_opengl.h" | # include "util/string.h" | ||||
| # include "util/util_path.h" | # include "util/system.h" | ||||
| # include "util/util_string.h" | # include "util/time.h" | ||||
| # include "util/util_system.h" | # include "util/types.h" | ||||
| # include "util/util_time.h" | # include "util/windows.h" | ||||
| # include "util/util_types.h" | |||||
| # include "util/util_windows.h" | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| class HIPDevice; | class HIPDevice; | ||||
| bool HIPDevice::have_precompiled_kernels() | bool HIPDevice::have_precompiled_kernels() | ||||
| { | { | ||||
| string fatbins_path = path_get("lib"); | string fatbins_path = path_get("lib"); | ||||
| ▲ Show 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | # endif | ||||
| string command = string_printf("%s -%s -I %s --%s %s -o \"%s\"", | string command = string_printf("%s -%s -I %s --%s %s -o \"%s\"", | ||||
| hipcc, | hipcc, | ||||
| options.c_str(), | options.c_str(), | ||||
| include_path.c_str(), | include_path.c_str(), | ||||
| kernel_ext, | kernel_ext, | ||||
| source_path.c_str(), | source_path.c_str(), | ||||
| fatbin.c_str()); | fatbin.c_str()); | ||||
| printf("Compiling HIP kernel ...\n%s\n", command.c_str()); | printf("Compiling %sHIP kernel ...\n%s\n", | ||||
| (use_adaptive_compilation()) ? "adaptive " : "", | |||||
| command.c_str()); | |||||
| # ifdef _WIN32 | # ifdef _WIN32 | ||||
| command = "call " + command; | command = "call " + command; | ||||
| # endif | # endif | ||||
| if (system(command.c_str()) != 0) { | if (system(command.c_str()) != 0) { | ||||
| set_error( | set_error( | ||||
| "Failed to execute compilation command, " | "Failed to execute compilation command, " | ||||
| "see console for details."); | "see console for details."); | ||||
| Show All 10 Lines | # endif | ||||
| printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); | printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); | ||||
| return fatbin; | return fatbin; | ||||
| } | } | ||||
| bool HIPDevice::load_kernels(const uint kernel_features) | bool HIPDevice::load_kernels(const uint kernel_features) | ||||
| { | { | ||||
| /* TODO(sergey): Support kernels re-load for HIP devices. | /* TODO(sergey): Support kernels re-load for CUDA devices adaptive compile. | ||||
| * | * | ||||
| * Currently re-loading kernel will invalidate memory pointers, | * Currently re-loading kernel will invalidate memory pointers, | ||||
| * causing problems in hipCtxSynchronize. | * causing problems in cuCtxSynchronize. | ||||
| */ | */ | ||||
| if (hipModule) { | if (hipModule) { | ||||
| VLOG(1) << "Skipping kernel reload, not currently supported."; | if (use_adaptive_compilation()) { | ||||
| VLOG(1) << "Skipping HIP kernel reload for adaptive compilation, not currently supported."; | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| /* check if hip init succeeded */ | /* check if hip init succeeded */ | ||||
| if (hipContext == 0) | if (hipContext == 0) | ||||
| return false; | return false; | ||||
| /* check if GPU is supported */ | /* check if GPU is supported */ | ||||
| ▲ Show 20 Lines • Show All 813 Lines • Show Last 20 Lines | |||||