Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/hip/device_impl.cpp
| Show First 20 Lines • Show All 370 Lines • ▼ Show 20 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 CUDA devices adaptive compile. | |||||
| * | |||||
| * Currently re-loading kernel will invalidate memory pointers, | |||||
| * causing problems in cuCtxSynchronize. | |||||
| */ | |||||
brecht: This comment is still relevant, we don't officially support it but if you try to use adaptive… | |||||
| if (hipModule) { | if (hipModule) { | ||||
| if (use_adaptive_compilation()) { | if (use_adaptive_compilation()) { | ||||
| VLOG(1) << "Skipping HIP kernel reload for adaptive compilation, not currently supported."; | 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 */ | ||||
| ▲ Show 20 Lines • Show All 503 Lines • ▼ Show 20 Lines | if (mem.is_resident(this) && mem.device_pointer) { | ||||
| generic_free(mem); | generic_free(mem); | ||||
| } | } | ||||
| } | } | ||||
| void HIPDevice::tex_alloc(device_texture &mem) | void HIPDevice::tex_alloc(device_texture &mem) | ||||
| { | { | ||||
| HIPContextScope scope(this); | HIPContextScope scope(this); | ||||
| /* General variables for both architectures */ | |||||
| string bind_name = mem.name; | string bind_name = mem.name; | ||||
| size_t dsize = datatype_size(mem.data_type); | size_t dsize = datatype_size(mem.data_type); | ||||
| size_t size = mem.memory_size(); | size_t size = mem.memory_size(); | ||||
| hipTextureAddressMode address_mode = hipAddressModeWrap; | hipTextureAddressMode address_mode = hipAddressModeWrap; | ||||
| switch (mem.info.extension) { | switch (mem.info.extension) { | ||||
| case EXTENSION_REPEAT: | case EXTENSION_REPEAT: | ||||
| address_mode = hipAddressModeWrap; | address_mode = hipAddressModeWrap; | ||||
| ▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | void HIPDevice::tex_alloc(device_texture &mem) | ||||
| } | } | ||||
| /* Set Mapping and tag that we need to (re-)upload to device */ | /* Set Mapping and tag that we need to (re-)upload to device */ | ||||
| texture_info[slot] = mem.info; | texture_info[slot] = mem.info; | ||||
| need_texture_info = true; | need_texture_info = true; | ||||
| if (mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT && | if (mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT && | ||||
| mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT3) { | mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT3) { | ||||
| /* Kepler+, bindless textures. */ | |||||
| hipResourceDesc resDesc; | hipResourceDesc resDesc; | ||||
| memset(&resDesc, 0, sizeof(resDesc)); | memset(&resDesc, 0, sizeof(resDesc)); | ||||
| if (array_3d) { | if (array_3d) { | ||||
| resDesc.resType = hipResourceTypeArray; | resDesc.resType = hipResourceTypeArray; | ||||
| resDesc.res.array.h_Array = &array_3d; | resDesc.res.array.h_Array = &array_3d; | ||||
| resDesc.flags = 0; | resDesc.flags = 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines | |||||
This comment is still relevant, we don't officially support it but if you try to use adaptive compilation with HIP this will be an issue.