MCPcopy Create free account
hub / github.com/ROCm/clr / ihipGetTextureAlignmentOffset

Function ihipGetTextureAlignmentOffset

hipamd/src/hip_texture.cpp:506–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506inline hipError_t ihipGetTextureAlignmentOffset(size_t* offset, const void* devPtr) {
507 amd::Device* device = hip::getCurrentDevice()->devices()[0];
508 const device::Info& info = device->info();
509 if (!info.imageSupport_) {
510 LogPrintfError("Texture not supported on the device %s", info.name_);
511 return hipErrorNotSupported;
512 }
513
514 const char* alignedDevPtr =
515 amd::alignUp(static_cast<const char*>(devPtr), info.imageBaseAddressAlignment_);
516 const size_t alignedOffset = alignedDevPtr - static_cast<const char*>(devPtr);
517
518 // If the device memory pointer was returned from hipMalloc(),
519 // the offset is guaranteed to be 0 and NULL may be passed as the offset parameter.
520 if ((alignedOffset != 0) && (offset == nullptr)) {
521 LogPrintfError("Texture object not aligned with offset %u", alignedOffset);
522 return hipErrorInvalidValue;
523 }
524
525 if (offset != nullptr) {
526 *offset = alignedOffset;
527 }
528
529 return hipSuccess;
530}
531
532hipError_t ihipBindTexture(size_t* offset, const textureReference* texref, const void* devPtr,
533 const hipChannelFormatDesc* desc, size_t size) {

Callers 3

ihipBindTextureFunction · 0.85
ihipBindTexture2DFunction · 0.85
hipTexRefSetAddressFunction · 0.85

Calls 3

getCurrentDeviceFunction · 0.85
alignUpFunction · 0.85
infoMethod · 0.45

Tested by

no test coverage detected