This avoids the use of extra casts when obtaining a texture object handle.
Change-Id: I42df22bdad0ab9ac6c33cb8b282dee65fe7cfd6e
[ROCm/clr commit: 6cfbe19160]
This also adds declarations of all the missing texture APIs.
hipTexRefSet*() functions need to take a textureReference as a ptr for type erasure to work. Runtime has been modified to accomodate this.
This change only applies to VDI.
Change-Id: Icf43cc5bd44dfc2c39084b7fe56d5a793bf7319f
[ROCm/clr commit: 428b56e411]
Instead of using the sampler field force_degamma to perform sRGB->linear conversion during pixel sampling, we use an appropriate image format instead. The overhead of this is having to create an image view when creating a texture object from an array.
Change-Id: I1ca368c312c1fd4b6f784a3a1b35b5eeb28070ff
[ROCm/clr commit: 23211f05d6]
The struct consists of a union - only the active object should be read.
Change-Id: I1c40965b61518acd91a2dcbae92a015ac9be346a
[ROCm/clr commit: 1cacb5c9b7]
We don't program the numChannels and format members (these are HCC specific), so printing these will only display garbage.
Change-Id: I83dc8be9a3cae2659c64f4594d07c05330d2dd14
[ROCm/clr commit: d662abaf55]
All we have to do is align the ptr to HW requirments an if it's not zero, then return the offset to the user.
We currently don't have anywhere to store this offset, so hipGetTextureAlignmentOffset() will still always return 0.
Change-Id: If31998127d99a2a3222a026d88249519d6102505
[ROCm/clr commit: 9823ccf5b0]
The hipExtModuleLaunchKernel and hipModuleLoadDataMultiThreaded tests keeps randomly failing on Jenkins.
Change-Id: I87e5d54fb7429c14ff1dcecb20e03a7816670fae
[ROCm/clr commit: 684cdd4a18]
Change-Id: If419d2fad490d0ed50eb1315af809fc1deda1ce3
SWDEV-227875: Add a lock in streams to lock when the callback is call so we make sure things aren't moving forward in the stream
[ROCm/clr commit: 9f81498bb5]
Change-Id: I1f107fc8a5c586cd571f0280ed8716c5f89d25b7
SWDEV-227875: Need to add a dummy marker in case the stream is empty.
[ROCm/clr commit: 31df9b358d]
What Cuda refers to "linear texture memory" is the OpenCL equivalent of CL_MEM_OBJECT_IMAGE1D_BUFFER. For these types of allocations we should create a typed buffer instead of an image.
Currently there is no check in the texture fetch functions as to what kind of SRD is written into the texture object, so any kind of incorrect programming will cause the TA to hang. Fortunately for us, every one writes correct code :)
Change-Id: I80dab85a992f2c0754ebf303d40ac6b5e045c7c1
[ROCm/clr commit: 78f7954765]
These are artifacts left from HIP-HCC and now are not needed by HIP-VDI.
Change-Id: Ib25a1081fe6146c8a89659395151e9d5bdaf7519
[ROCm/clr commit: 8083935855]
Currently the texture C++ API is forwarded to the ihip*Impl() calls, which are not even a part of Cuda. These should be forwarded to their respective Cuda C APIs instead.
This change also fixes a bug with hipUnbindTexture() creating a dangling pointer.
Change-Id: Ifafc9d106855a11bec84a18ea214b3d89e39990d
[ROCm/clr commit: 53dd6b7a66]
Currently we extract the read mode from the ihip*impl() calls, which is not correct. We should be getting it from the texture itself directly.
Change-Id: Idf6449fefa395a887138a252e8ea937a6897e600
[ROCm/clr commit: 42b149fe3c]
hipBindTextureToMipmappedArray()
The texture reference needs to be passed as a constant pointer.
Change-Id: I6d31204c7f2325a5bc1e8b6e089fd9f8d21d1d78
[ROCm/clr commit: 9731b61a60]
reinterpret_cast<> doesn't create an object, so the texref is actually unitiliazed. This may lead to garbage data in some of its struct members.
Initialize it by performing a placement new. The constructer should set all of its members to default values. There's no way currently to extract the channel type, so use single channel char for now.
Change-Id: I41b305a75bb3f30130324de785099f55b3e130c7
[ROCm/clr commit: b4a0008b36]
Similar to the previous patch, this change adds type constraints to texture indirect functions. Since we don't have to deduce the return type for these, we simply just have to check if the user provided a valid channel type.
Change-Id: Ia094bd6126e01df2ea90902c9aa59cb6cfe85773
[ROCm/clr commit: 8667e21b25]
When sampling a pixel the hw always returns a float4. The type in the texture reference controls the bitcast that we perform before returning the sampled pixel. Creating a texture with an unsupported will lead to potential UB.
This change makes it so that it's only possible to use textures with a type that makes sense. Using something like texture<int, hipTextureType1D, hipReadModeNormalizedFloat> will now lead to a compilation error with a message "Invalid channel type!".
Change-Id: I7fde44cb1d4b9737e0c48c28cb59c018c59ccaa2
[ROCm/clr commit: a994da8af6]
This change addresses three things.
First the available APIs are brought up to par with Cuda (missing ones are added and incorrect ones removed).
Second the size of hip/hcc_detail/texture_functions.h. Using some template magic we can bring down the code size down from ~11k lines to only ~900 lines in total.
Third this change fixes some bugs in the declaration of the texture fetch funcitons. Currently the return type for textures with read mode set to hipReadModeNormalizedFloat is not float. This causes pixel data to be lost during the bitcast when the texture pixel element size is less than the size of float.
The new headers will only be enabled for VDI to avoid breaking HCC.
Change-Id: I77cb29293fb79e55681be094c37702a48d80b64c
[ROCm/clr commit: 3d7945faae]
This is currently so buggy that it causes a runtime crash on Nvidia platfrom...
Disable the new version for hcc and vdi, header fixes are required for it to pass.
Currently tex1D<char, hipTextureType1D, hipReadModeNormalizedFloat> returns a char, when the actual sampled pixel value is a float, so the hi 3 bytes get lost.
Change-Id: I8222a4d8d1d8b101eb43f3f8dfbe4818f885f8ea
[ROCm/clr commit: 3abd89925a]
Implement _ihipGetGlobalVar() and ihipGetGlobalVar() to
get global variables.
Change-Id: I442ab6712e12306c3316f114f5dc42f6daefaad9
[ROCm/clr commit: 8e9e6a44a4]
There are now two implementations of printf in HIP:
1. The implemenation for HCC is controlled by the HC_FEATURE_PRINTF
macro, and it works only with the HCC compiler used in combination
with the HCC runtime.
2. The implementation for hip-clang requires the VDI runtime, and is
always enabled with that combination.
Change-Id: Ibaeda7900ffe2ce602ca0094aafed0f1147ac2b6
[ROCm/clr commit: d48738856c]