Adjust clang format to the new versions, revert broken macro layout (#714)
Este commit está contenido en:
cometido por
GitHub
padre
ed877433f3
commit
2ff2316227
@@ -156,8 +156,8 @@ bool isCodeObjectCompatibleWithDevice(std::string co_triple_target_id,
|
||||
static inline unsigned int getGenericVersion(const void* image) {
|
||||
const Elf64_Ehdr* ehdr = reinterpret_cast<const Elf64_Ehdr*>(image);
|
||||
return ehdr->e_ident[EI_ABIVERSION] == ELFABIVERSION_AMDGPU_HSA_V6
|
||||
? ((ehdr->e_flags & EF_AMDGPU_GENERIC_VERSION) >> EF_AMDGPU_GENERIC_VERSION_OFFSET)
|
||||
: 0;
|
||||
? ((ehdr->e_flags & EF_AMDGPU_GENERIC_VERSION) >> EF_AMDGPU_GENERIC_VERSION_OFFSET)
|
||||
: 0;
|
||||
}
|
||||
|
||||
static inline bool isGenericTarget(const void* image) {
|
||||
@@ -178,10 +178,9 @@ bool UnbundleBitCode(const std::vector<char>& bundled_llvm_bitcode, const std::s
|
||||
const void* data = reinterpret_cast<const void*>(bundled_llvm_bitcode_s.c_str());
|
||||
const auto obheader = reinterpret_cast<const __ClangOffloadBundleHeader*>(data);
|
||||
const auto* desc = &obheader->desc[0];
|
||||
for (uint64_t idx = 0; idx < obheader->numOfCodeObjects; ++idx,
|
||||
desc = reinterpret_cast<const __ClangOffloadBundleInfo*>(
|
||||
reinterpret_cast<uintptr_t>(&desc->bundleEntryId[0]) +
|
||||
desc->bundleEntryIdSize)) {
|
||||
for (uint64_t idx = 0; idx < obheader->numOfCodeObjects;
|
||||
++idx, desc = reinterpret_cast<const __ClangOffloadBundleInfo*>(
|
||||
reinterpret_cast<uintptr_t>(&desc->bundleEntryId[0]) + desc->bundleEntryIdSize)) {
|
||||
const void* image =
|
||||
reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(obheader) + desc->offset);
|
||||
const size_t image_size = desc->size;
|
||||
@@ -736,9 +735,8 @@ bool demangleName(const std::string& mangledName, std::string& demangledName) {
|
||||
|
||||
demangledName.resize(demangled_size);
|
||||
|
||||
if (AMD_COMGR_STATUS_SUCCESS !=
|
||||
amd::Comgr::get_data(demangled_data, &demangled_size,
|
||||
const_cast<char*>(demangledName.data()))) {
|
||||
if (AMD_COMGR_STATUS_SUCCESS != amd::Comgr::get_data(demangled_data, &demangled_size,
|
||||
const_cast<char*>(demangledName.data()))) {
|
||||
amd::Comgr::release_data(mangled_data);
|
||||
amd::Comgr::release_data(demangled_data);
|
||||
return false;
|
||||
|
||||
@@ -135,7 +135,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
|
||||
command->awaitCompletion();
|
||||
ms = static_cast<float>(static_cast<int64_t>(command->event().profilingInfo().end_) -
|
||||
time(false)) /
|
||||
1000000.f;
|
||||
1000000.f;
|
||||
command->release();
|
||||
} else {
|
||||
// Note: with direct dispatch eStop.ready() relies on HW event, but CPU status can be delayed.
|
||||
@@ -210,7 +210,8 @@ hipError_t Event::streamWait(hip::Stream* stream, uint flags) {
|
||||
hipError_t Event::recordCommand(amd::Command*& command, amd::HostQueue* stream, uint32_t ext_flags,
|
||||
bool batch_flush) {
|
||||
if (command == nullptr) {
|
||||
int32_t releaseFlags = ((ext_flags == 0) ? flags_ : ext_flags) &
|
||||
int32_t releaseFlags =
|
||||
((ext_flags == 0) ? flags_ : ext_flags) &
|
||||
(hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventDisableSystemFence);
|
||||
if (releaseFlags & hipEventDisableSystemFence) {
|
||||
releaseFlags = amd::Device::kCacheStateIgnore;
|
||||
@@ -269,8 +270,8 @@ bool isValid(hipEvent_t event) {
|
||||
// ================================================================================================
|
||||
hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) {
|
||||
unsigned supportedFlags = hipEventDefault | hipEventBlockingSync | hipEventDisableTiming |
|
||||
hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventInterprocess |
|
||||
hipEventDisableSystemFence;
|
||||
hipEventReleaseToDevice | hipEventReleaseToSystem |
|
||||
hipEventInterprocess | hipEventDisableSystemFence;
|
||||
|
||||
const unsigned releaseFlags =
|
||||
(hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventDisableSystemFence);
|
||||
@@ -284,7 +285,7 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) {
|
||||
}
|
||||
return bitcount;
|
||||
}(flags & releaseFlags) > 1) ||
|
||||
((flags & hipEventInterprocess) && !(flags & hipEventDisableTiming));
|
||||
((flags & hipEventInterprocess) && !(flags & hipEventDisableTiming));
|
||||
if (!illegalFlags) {
|
||||
hip::Event* e = nullptr;
|
||||
if (flags & hipEventInterprocess) {
|
||||
|
||||
@@ -37,10 +37,9 @@ template <typename comgr_T> class ComgrUniqueHandle {
|
||||
// constructor which takes ownership of a correctly initialzed handle
|
||||
ComgrUniqueHandle(comgr_T& handle) : comgr_obj_(handle) { handle = {0}; };
|
||||
|
||||
template <typename T = comgr_T,
|
||||
std::enable_if_t<std::is_same_v<T, amd_comgr_data_set_t> ||
|
||||
std::is_same_v<T, amd_comgr_action_info_t>,
|
||||
bool> = true>
|
||||
template <typename T = comgr_T, std::enable_if_t<std::is_same_v<T, amd_comgr_data_set_t> ||
|
||||
std::is_same_v<T, amd_comgr_action_info_t>,
|
||||
bool> = true>
|
||||
[[nodiscard]] amd_comgr_status_t Create() {
|
||||
if constexpr (std::is_same_v<T, amd_comgr_data_set_t>) {
|
||||
return amd::Comgr::create_data_set(&comgr_obj_);
|
||||
@@ -736,9 +735,9 @@ hipError_t FatBinaryInfo::BuildProgram(const int device_id) {
|
||||
|
||||
// If Program was already built skip this step and return success
|
||||
if (dev_programs_[device_id]->IsProgramBuilt(*g_devices[device_id]->devices()[0]) == false) {
|
||||
if (CL_SUCCESS !=
|
||||
dev_programs_[device_id]->build(g_devices[device_id]->devices(), nullptr, nullptr, nullptr,
|
||||
kOptionChangeable, kNewDevProg)) {
|
||||
if (CL_SUCCESS != dev_programs_[device_id]->build(g_devices[device_id]->devices(), nullptr,
|
||||
nullptr, nullptr, kOptionChangeable,
|
||||
kNewDevProg)) {
|
||||
return hipErrorNoBinaryForGpu;
|
||||
}
|
||||
if (!dev_programs_[device_id]->load()) {
|
||||
|
||||
@@ -581,8 +581,8 @@ bool Graph::RunOneNode(Node node, bool wait) {
|
||||
for (auto edge : node->GetEdges()) {
|
||||
// Don't wait in the nodes, executed on the same streams and if it has just one dependency
|
||||
bool wait = ((i < DEBUG_HIP_FORCE_GRAPH_QUEUES) || (edge->GetDependencies().size() > 1))
|
||||
? true
|
||||
: false;
|
||||
? true
|
||||
: false;
|
||||
// Execute the edge node
|
||||
if (!RunOneNode(edge, wait)) {
|
||||
return false;
|
||||
|
||||
@@ -366,9 +366,8 @@ class GraphNode : public hipGraphNodeDOTAttribute {
|
||||
virtual void EnqueueCommands(hip::Stream* stream) {
|
||||
// If the node is disabled it becomes empty node. To maintain ordering just enqueue marker.
|
||||
// Node can be enabled/disabled only for kernel, memcpy and memset nodes.
|
||||
if (!isEnabled_ &&
|
||||
(type_ == hipGraphNodeTypeKernel || type_ == hipGraphNodeTypeMemcpy ||
|
||||
type_ == hipGraphNodeTypeMemset)) {
|
||||
if (!isEnabled_ && (type_ == hipGraphNodeTypeKernel || type_ == hipGraphNodeTypeMemcpy ||
|
||||
type_ == hipGraphNodeTypeMemset)) {
|
||||
amd::Command::EventWaitList waitList;
|
||||
if (!commands_.empty()) {
|
||||
waitList = commands_[0]->eventWaitList();
|
||||
@@ -1677,7 +1676,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
||||
label = buffer;
|
||||
} else {
|
||||
label = std::to_string(GetID()) + "\n" + label_ + "\n(" + memcpyDirection + "," +
|
||||
std::to_string(count_) + ")";
|
||||
std::to_string(count_) + ")";
|
||||
}
|
||||
return label;
|
||||
}
|
||||
@@ -1948,7 +1947,7 @@ class GraphMemsetNode : public GraphNode {
|
||||
sizeBytes = memsetParams_.width * memsetParams_.height * depth_ * memsetParams_.elementSize;
|
||||
}
|
||||
label = std::to_string(GetID()) + "\n" + label_ + "\n(" +
|
||||
std::to_string(memsetParams_.value) + "," + std::to_string(sizeBytes) + ")";
|
||||
std::to_string(memsetParams_.value) + "," + std::to_string(sizeBytes) + ")";
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ hipError_t hipStreamAttachMemAsync(hipStream_t stream, void* dev_ptr, size_t len
|
||||
// This type of memory may only be specified if the device associated with the
|
||||
// stream reports a non-zero value for the device attribute hipDevAttrPageableMemoryAccess.
|
||||
hip::Stream* hip_stream = (stream == nullptr || stream == hipStreamLegacy)
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: hip::getStream(stream);
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: hip::getStream(stream);
|
||||
size_t offset = 0;
|
||||
amd::Memory* memObj = getMemoryObject(dev_ptr, offset);
|
||||
if (memObj == nullptr) {
|
||||
@@ -328,13 +328,13 @@ hipError_t ihipMemPrefetchAsync(const void* dev_ptr, size_t count, hipMemLocatio
|
||||
// Pick the specified stream or Null one from the provided target device
|
||||
if (cpuAccess == true) {
|
||||
hip_stream = (stream == nullptr || stream == hipStreamLegacy)
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: hip::getStream(stream);
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: hip::getStream(stream);
|
||||
} else {
|
||||
dev = g_devices[targetDevice]->devices()[0];
|
||||
hip_stream = (stream == nullptr || stream == hipStreamLegacy)
|
||||
? g_devices[targetDevice]->NullStream()
|
||||
: hip::getStream(stream);
|
||||
? g_devices[targetDevice]->NullStream()
|
||||
: hip::getStream(stream);
|
||||
}
|
||||
|
||||
if (hip_stream == nullptr) {
|
||||
|
||||
@@ -327,9 +327,9 @@ class Stream : public amd::HostQueue {
|
||||
unsigned long long captureID_;
|
||||
|
||||
static inline CommandQueue::Priority convertToQueuePriority(Priority p) {
|
||||
return p == Priority::High ? amd::CommandQueue::Priority::High
|
||||
: p == Priority::Low ? amd::CommandQueue::Priority::Low
|
||||
: amd::CommandQueue::Priority::Normal;
|
||||
return p == Priority::High ? amd::CommandQueue::Priority::High
|
||||
: p == Priority::Low ? amd::CommandQueue::Priority::Low
|
||||
: amd::CommandQueue::Priority::Normal;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -67,8 +67,8 @@ hipMemoryType getMemoryType(const amd::Memory* memory) {
|
||||
}
|
||||
|
||||
return ((CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_USE_HOST_PTR) & memory->getMemFlags())
|
||||
? hipMemoryTypeHost
|
||||
: hipMemoryTypeDevice;
|
||||
? hipMemoryTypeHost
|
||||
: hipMemoryTypeDevice;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
@@ -336,8 +336,8 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags) {
|
||||
hip::getCurrentDevice()->SetActiveStatus();
|
||||
|
||||
size_t max_device_size = IS_LINUX
|
||||
? dev_info.maxMemAllocSize_
|
||||
: (dev_info.maxMemAllocSize_ + dev_info.maxPhysicalMemAllocSize_);
|
||||
? dev_info.maxMemAllocSize_
|
||||
: (dev_info.maxMemAllocSize_ + dev_info.maxPhysicalMemAllocSize_);
|
||||
|
||||
if ((useHostDevice && dev_info.maxPhysicalMemAllocSize_ < sizeBytes) ||
|
||||
(!useHostDevice && max_device_size < sizeBytes)) {
|
||||
@@ -401,9 +401,8 @@ hipError_t ihipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) {
|
||||
}
|
||||
|
||||
if (flags == 0 ||
|
||||
flags &
|
||||
(hipHostMallocCoherent | hipHostMallocMapped | hipHostMallocNumaUser |
|
||||
hipHostMallocUncached) ||
|
||||
flags & (hipHostMallocCoherent | hipHostMallocMapped | hipHostMallocNumaUser |
|
||||
hipHostMallocUncached) ||
|
||||
(!(flags & hipHostMallocNonCoherent) && HIP_HOST_COHERENT)) {
|
||||
ihipFlags |= CL_MEM_SVM_ATOMICS;
|
||||
}
|
||||
@@ -1143,7 +1142,7 @@ hipError_t ihipArrayCreate(hipArray_t* array, const HIP_ARRAY3D_DESCRIPTOR* pAll
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
unsigned int flags = hipArrayDefault | hipArrayLayered | hipArraySurfaceLoadStore |
|
||||
hipArrayTextureGather; // hipArrayCubemap isn't supported
|
||||
hipArrayTextureGather; // hipArrayCubemap isn't supported
|
||||
if (pAllocateArray->Flags & (~flags)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
@@ -1282,9 +1281,8 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) {
|
||||
|
||||
hipError_t ihipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) {
|
||||
if (hostPtr == nullptr || sizeBytes == 0 ||
|
||||
flags &
|
||||
~(hipHostRegisterPortable | hipHostRegisterMapped | hipExtHostRegisterCoarseGrained |
|
||||
hipExtHostRegisterUncached)) {
|
||||
flags & ~(hipHostRegisterPortable | hipHostRegisterMapped | hipExtHostRegisterCoarseGrained |
|
||||
hipExtHostRegisterUncached)) {
|
||||
return hipErrorInvalidValue;
|
||||
} else {
|
||||
unsigned int memFlags = CL_MEM_USE_HOST_PTR | CL_MEM_SVM_ATOMICS;
|
||||
@@ -1377,9 +1375,8 @@ hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
|
||||
if (ptr == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if (flags &
|
||||
~(hipHostAllocPortable | hipHostAllocMapped | hipHostAllocWriteCombined |
|
||||
hipHostAllocUncached)) {
|
||||
if (flags & ~(hipHostAllocPortable | hipHostAllocMapped | hipHostAllocWriteCombined |
|
||||
hipHostAllocUncached)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
@@ -1868,9 +1865,9 @@ hipError_t ihipMemcpyHtoH(void* dstHost, const void* srcHost, amd::Coord3D copyR
|
||||
for (size_t slice = 0; slice < copyRegion[2]; slice++) {
|
||||
for (size_t row = 0; row < copyRegion[1]; row++) {
|
||||
const void* srcRow = static_cast<const char*>(srcHost) + srcRect.start_ +
|
||||
row * srcRect.rowPitch_ + slice * srcRect.slicePitch_;
|
||||
row * srcRect.rowPitch_ + slice * srcRect.slicePitch_;
|
||||
void* dstRow = static_cast<char*>(dstHost) + dstRect.start_ + row * dstRect.rowPitch_ +
|
||||
slice * dstRect.slicePitch_;
|
||||
slice * dstRect.slicePitch_;
|
||||
std::memcpy(dstRow, srcRow, copyRegion[0]);
|
||||
}
|
||||
}
|
||||
@@ -2331,9 +2328,8 @@ hipError_t ihipMemcpyParam3D(const HIP_MEMCPY3D* pCopy, hipStream_t stream, bool
|
||||
// Transfers from device memory to pageable host memory and transfers from any
|
||||
// host memory to any host memory are synchronous with respect to the host.
|
||||
// Device to Device copies do not need to host side synchronization.
|
||||
if (dstMemoryType == hipMemoryTypeHost ||
|
||||
((pCopy->srcMemoryType == hipMemoryTypeHost) &&
|
||||
(pCopy->dstMemoryType == hipMemoryTypeHost))) {
|
||||
if (dstMemoryType == hipMemoryTypeHost || ((pCopy->srcMemoryType == hipMemoryTypeHost) &&
|
||||
(pCopy->dstMemoryType == hipMemoryTypeHost))) {
|
||||
isAsync = false;
|
||||
} else if ((pCopy->srcMemoryType == hipMemoryTypeDevice) &&
|
||||
(pCopy->dstMemoryType == hipMemoryTypeDevice)) {
|
||||
@@ -4111,7 +4107,7 @@ hipError_t ihipMipmapArrayCreate(hipMipmappedArray_t* mipmapped_array_pptr,
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
unsigned int flags = hipArrayDefault | hipArrayLayered | hipArraySurfaceLoadStore |
|
||||
hipArrayTextureGather; // hipArrayCubemap isn't supported
|
||||
hipArrayTextureGather; // hipArrayCubemap isn't supported
|
||||
if (mipmapped_array_desc_ptr->Flags & (~flags)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
@@ -380,8 +380,8 @@ hipError_t hipMallocFromPoolAsync(void** dev_ptr, size_t size, hipMemPool_t mem_
|
||||
|
||||
auto mpool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
|
||||
auto hip_stream = (stream == nullptr || stream == hipStreamLegacy)
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: reinterpret_cast<hip::Stream*>(stream);
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: reinterpret_cast<hip::Stream*>(stream);
|
||||
*dev_ptr = mpool->AllocateMemory(size, hip_stream);
|
||||
if (*dev_ptr == nullptr) {
|
||||
HIP_RETURN(hipErrorOutOfMemory);
|
||||
|
||||
@@ -422,9 +422,9 @@ hipError_t MemoryPool::GetAttribute(hipMemPoolAttr attr, void* value) {
|
||||
break;
|
||||
case hipMemPoolAttrReservedMemCurrent:
|
||||
// All allocated memory by the pool in OS
|
||||
*reinterpret_cast<uint64_t*>(value) = (state_.use_vm_heap_)
|
||||
? MappedSize()
|
||||
: (busy_heap_.GetTotalSize() + free_heap_.GetTotalSize());
|
||||
*reinterpret_cast<uint64_t*>(value) =
|
||||
(state_.use_vm_heap_) ? MappedSize()
|
||||
: (busy_heap_.GetTotalSize() + free_heap_.GetTotalSize());
|
||||
break;
|
||||
case hipMemPoolAttrReservedMemHigh:
|
||||
// High watermark of all allocated memory in OS, since the last reset
|
||||
|
||||
@@ -165,7 +165,7 @@ hipError_t hipFuncGetAttribute(int* value, hipFunction_attribute attrib, hipFunc
|
||||
case HIP_FUNC_ATTRIBUTE_PTX_VERSION:
|
||||
case HIP_FUNC_ATTRIBUTE_BINARY_VERSION:
|
||||
*value = hip::getCurrentDevice()->devices()[0]->isa().versionMajor() * 10 +
|
||||
hip::getCurrentDevice()->devices()[0]->isa().versionMinor();
|
||||
hip::getCurrentDevice()->devices()[0]->isa().versionMinor();
|
||||
break;
|
||||
case HIP_FUNC_ATTRIBUTE_CACHE_MODE_CA:
|
||||
*value = 0;
|
||||
@@ -224,9 +224,8 @@ hipError_t hipFuncSetAttribute(const void* func, hipFuncAttribute attr, int valu
|
||||
(device::Kernel*)(kernel->getDeviceKernel(*(hip::getCurrentDevice()->devices()[0])));
|
||||
|
||||
if (attr == hipFuncAttributeMaxDynamicSharedMemorySize) {
|
||||
if ((value < 0) ||
|
||||
(value > (d_kernel->workGroupInfo()->availableLDSSize_ -
|
||||
d_kernel->workGroupInfo()->localMemSize_))) {
|
||||
if ((value < 0) || (value > (d_kernel->workGroupInfo()->availableLDSSize_ -
|
||||
d_kernel->workGroupInfo()->localMemSize_))) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
d_kernel->workGroupInfo()->maxDynamicSharedSizeBytes_ = value;
|
||||
|
||||
@@ -79,9 +79,8 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, const hipReso
|
||||
|
||||
// pResViewDesc can only be specified if the type of resource is a HIP array or a HIP mipmapped
|
||||
// array.
|
||||
if ((pResViewDesc != nullptr) &&
|
||||
((pResDesc->resType != hipResourceTypeArray) &&
|
||||
(pResDesc->resType != hipResourceTypeMipmappedArray))) {
|
||||
if ((pResViewDesc != nullptr) && ((pResDesc->resType != hipResourceTypeArray) &&
|
||||
(pResDesc->resType != hipResourceTypeMipmappedArray))) {
|
||||
return hipErrorUnknown;
|
||||
}
|
||||
|
||||
@@ -176,9 +175,8 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, const hipReso
|
||||
// hipAddressModeWrap and hipAddressModeMirror won't be supported
|
||||
// and will be switched to hipAddressModeClamp.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if ((pTexDesc->normalizedCoords == 0) &&
|
||||
((pTexDesc->addressMode[i] == hipAddressModeWrap) ||
|
||||
(pTexDesc->addressMode[i] == hipAddressModeMirror))) {
|
||||
if ((pTexDesc->normalizedCoords == 0) && ((pTexDesc->addressMode[i] == hipAddressModeWrap) ||
|
||||
(pTexDesc->addressMode[i] == hipAddressModeMirror))) {
|
||||
addressMode[i] = hip::getCLAddressingMode(hipAddressModeClamp);
|
||||
}
|
||||
// hipTextureDesc::addressMode is ignored if hipResourceDesc::resType is hipResourceTypeLinear
|
||||
@@ -237,12 +235,14 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, const hipReso
|
||||
if ((pResViewDesc != nullptr) || (readMode == hipReadModeNormalizedFloat) ||
|
||||
(pTexDesc->sRGB == 1)) {
|
||||
// TODO ROCclr currently right now can only change the format of the image.
|
||||
const cl_channel_order channelOrder = (pResViewDesc != nullptr)
|
||||
? hip::getCLChannelOrder(hip::getNumChannels(pResViewDesc->format), pTexDesc->sRGB)
|
||||
: hip::getCLChannelOrder(pResDesc->res.array.array->NumChannels, pTexDesc->sRGB);
|
||||
const cl_channel_type channelType = (pResViewDesc != nullptr)
|
||||
? hip::getCLChannelType(hip::getArrayFormat(pResViewDesc->format), readMode)
|
||||
: hip::getCLChannelType(pResDesc->res.array.array->Format, readMode);
|
||||
const cl_channel_order channelOrder =
|
||||
(pResViewDesc != nullptr)
|
||||
? hip::getCLChannelOrder(hip::getNumChannels(pResViewDesc->format), pTexDesc->sRGB)
|
||||
: hip::getCLChannelOrder(pResDesc->res.array.array->NumChannels, pTexDesc->sRGB);
|
||||
const cl_channel_type channelType =
|
||||
(pResViewDesc != nullptr)
|
||||
? hip::getCLChannelType(hip::getArrayFormat(pResViewDesc->format), readMode)
|
||||
: hip::getCLChannelType(pResDesc->res.array.array->Format, readMode);
|
||||
const amd::Image::Format imageFormat(cl_image_format{channelOrder, channelType});
|
||||
if (!imageFormat.isValid()) {
|
||||
return hipErrorInvalidValue;
|
||||
@@ -277,12 +277,14 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, const hipReso
|
||||
if ((pResViewDesc != nullptr) || (readMode == hipReadModeNormalizedFloat) ||
|
||||
(pTexDesc->sRGB == 1)) {
|
||||
// TODO ROCclr currently right now can only change the format of the image.
|
||||
const cl_channel_order channelOrder = (pResViewDesc != nullptr)
|
||||
? hip::getCLChannelOrder(hip::getNumChannels(pResViewDesc->format), pTexDesc->sRGB)
|
||||
: hip::getCLChannelOrder(pResDesc->res.mipmap.mipmap->num_channels, pTexDesc->sRGB);
|
||||
const cl_channel_type channelType = (pResViewDesc != nullptr)
|
||||
? hip::getCLChannelType(hip::getArrayFormat(pResViewDesc->format), readMode)
|
||||
: hip::getCLChannelType(pResDesc->res.mipmap.mipmap->format, readMode);
|
||||
const cl_channel_order channelOrder =
|
||||
(pResViewDesc != nullptr)
|
||||
? hip::getCLChannelOrder(hip::getNumChannels(pResViewDesc->format), pTexDesc->sRGB)
|
||||
: hip::getCLChannelOrder(pResDesc->res.mipmap.mipmap->num_channels, pTexDesc->sRGB);
|
||||
const cl_channel_type channelType =
|
||||
(pResViewDesc != nullptr)
|
||||
? hip::getCLChannelType(hip::getArrayFormat(pResViewDesc->format), readMode)
|
||||
: hip::getCLChannelType(pResDesc->res.mipmap.mipmap->format, readMode);
|
||||
const amd::Image::Format imageFormat(cl_image_format{channelOrder, channelType});
|
||||
if (!imageFormat.isValid()) {
|
||||
return hipErrorInvalidValue;
|
||||
@@ -335,7 +337,8 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, const hipReso
|
||||
hip::getArrayFormat(pResDesc->res.pitch2D.desc), pTexDesc->readMode);
|
||||
const amd::Image::Format imageFormat({channelOrder, channelType});
|
||||
const cl_mem_object_type imageType = hip::getCLMemObjectType(pResDesc->resType);
|
||||
const size_t imageSizeInBytes = pResDesc->res.pitch2D.width * imageFormat.getElementSize() +
|
||||
const size_t imageSizeInBytes =
|
||||
pResDesc->res.pitch2D.width * imageFormat.getElementSize() +
|
||||
pResDesc->res.pitch2D.pitchInBytes * (pResDesc->res.pitch2D.height - 1);
|
||||
amd::Memory* buffer =
|
||||
getMemoryObjectWithOffset(pResDesc->res.pitch2D.devPtr, imageSizeInBytes);
|
||||
|
||||
Referencia en una nueva incidencia
Block a user