Commit Graph

5051 Commits

Author SHA1 Message Date
Saleel Kudchadker 68df8efe90 Sync streams when freeing or destroying mem
Change-Id: I6932f225a8b932bb2adbd5e37880f7e604496809
2020-03-20 10:53:23 -07:00
Christophe Paquot 446c8685e2 Merge "hipStreamAddCallback test seg faults" into amd-master-next 2020-03-20 12:05:37 -04:00
kjayapra-amd 334a1f8770 SWDEV-216213 - Lookup module functions from PlatformState::functions_.
Change-Id: I91dfe327f2ebdcf4c9b39ddd14d60aa0ce2fa9f4
2020-03-20 11:52:28 -04:00
Christophe Paquot 31df9b358d hipStreamAddCallback test seg faults
Change-Id: I1f107fc8a5c586cd571f0280ed8716c5f89d25b7
SWDEV-227875: Need to add a dummy marker in case the stream is empty.
2020-03-19 11:11:59 -07:00
Vladislav Sytchenko 78f7954765 Add support for creating typed buffers
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
2020-03-18 18:15:17 -04:00
Vladislav Sytchenko ea7170d33c Program texture flags in a better way
Not sure what I was thinking when initially implementing this...

Change-Id: Ib82f0f5a86683c08823dd4b59c98259d27151822
2020-03-18 18:15:09 -04:00
Vladislav Sytchenko 8083935855 Purge the use of ihip*impl() texture APIs
These are artifacts left from HIP-HCC and now are not needed by HIP-VDI.

Change-Id: Ib25a1081fe6146c8a89659395151e9d5bdaf7519
2020-03-18 18:15:01 -04:00
Vladislav Sytchenko 53dd6b7a66 Rework the texture C++ API
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
2020-03-18 18:14:53 -04:00
Vladislav Sytchenko 42b149fe3c Correctly infer the texture read mode
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
2020-03-18 18:14:45 -04:00
Vladislav Sytchenko 9731b61a60 Correct the definition of ...
hipBindTextureToMipmappedArray()

The texture reference needs to be passed as a constant pointer.

Change-Id: I6d31204c7f2325a5bc1e8b6e089fd9f8d21d1d78
2020-03-18 18:14:36 -04:00
Vladislav Sytchenko 7a81e55de7 Correct the declaration of hipBindTexture2D()
The texture reference needs to be passed as a constant pointer.

Change-Id: Idde461f0f328ac87ce677b6bab3203161b514cbf
2020-03-18 18:08:23 -04:00
Vladislav Sytchenko 7765792a42 Correct the declaration of hipBindTextureToArray()
The texture reference needs to be passed as a constant pointer.

Change-Id: Iff171626536071fb2020cfff7132ec930577b1b9
2020-03-18 18:08:13 -04:00
Vladislav Sytchenko 600b1006c8 Correct the declaration of hipBindTexture()
The texture reference needs to be passed as a constant pointer.

Change-Id: I36ca0bddaba30becfc2ce70dd9e5b7db66c57f27
2020-03-18 18:08:01 -04:00
Vladislav Sytchenko 6ff0d15a62 Add missing mipmap API entries
Introduce hipFreeMipmappedArray(), hipMallocMipmappedArray() and hipGetMipmappedArrayLevel() APIs.

Change-Id: I878228c79fa1c54536c17d6baf45f83d51d2b1c7
2020-03-18 18:07:45 -04:00
Vladislav Sytchenko b4b05e2ab0 Don't hardcode the texture read mode
The readmode needs to be inferred from the template arguments.

Change-Id: I067037035e2492a24eac47e16d4015f879be0ea7
2020-03-18 18:07:33 -04:00
Vladislav Sytchenko da5f852cdd Merge "Start the lifetime of the texture reference" into amd-master-next 2020-03-18 18:07:24 -04:00
Jiabao Xie bbfba3bae1 Merge "Cleaned include statements and deleted unnecessary operator overloads" into amd-master-next 2020-03-18 14:37:19 -04:00
Vladislav Sytchenko b4a0008b36 Start the lifetime of the texture reference
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
2020-03-18 12:30:11 -04:00
Vladislav Sytchenko 8667e21b25 Add constraints to texture indirect functions
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
2020-03-18 12:24:40 -04:00
Vladislav Sytchenko a994da8af6 Add constraints to texture fetch functions
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
2020-03-18 12:24:40 -04:00
Sarbojit Sarkar 4cd02f20cf Merge "[hip-vdi]Fix for TF build failure [SWDEV-225827]" into amd-master-next 2020-03-18 11:52:46 -04:00
Jatin Chaudhary d32802a176 Merge "Enable saxpy Test" into amd-master-next 2020-03-18 06:32:05 -04:00
Sarbojit Sarkar 957caff8b4 [hip-vdi]Fix for TF build failure [SWDEV-225827]
Change-Id: I8478779bef92bad8353b8d066b28c220bb59b98d
2020-03-17 22:52:01 -04:00
Vladislav Sytchenko 3150e1ef8d Enable simpleTexture2DLayered test for VDI
Change-Id: I420f68824c6825152ac50e5a129b11b6ad88deb9
2020-03-17 17:50:46 -04:00
Vladislav Sytchenko 8d01fad7ef Enable hipNormalizedFloatValueTex test for VDI
Change-Id: Iac8631312f34821d919b69b3fcb92b9387ba31dd
2020-03-17 17:50:30 -04:00
Tao Sang b0defd2676 Merge "Fix failure to get global variables" into amd-master-next 2020-03-17 17:08:14 -04:00
Vladislav Sytchenko 3d7945faae Rework device texture headers
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
2020-03-17 17:04:37 -04:00
Vladislav Sytchenko 3abd89925a Rework hipNormalizedFloatValueTex test
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
2020-03-17 17:04:17 -04:00
Saleel Kudchadker 36a07434ea Merge "libhiprtc.so needs to be installed in DEST dir" into amd-master-next 2020-03-17 16:17:55 -04:00
Tao Sang 8e9e6a44a4 Fix failure to get global variables
Implement _ihipGetGlobalVar() and ihipGetGlobalVar() to
get global variables.

Change-Id: I442ab6712e12306c3316f114f5dc42f6daefaad9
2020-03-17 16:14:16 -04:00
Vladislav Sytchenko 7da159bac2 Merge "Enable simpleTexture3D test for VDI" into amd-master-next 2020-03-17 11:41:05 -04:00
Jatin fa10ee3301 Enable saxpy Test
Change-Id: Iadb5f631e1cebaf016b1835510771b3b7fac0a55
2020-03-17 01:15:20 -04:00
Sameer Sahasrabuddhe d48738856c SWDEV-204784: separate printf declaration for vdi/clang
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
2020-03-16 04:00:39 -04:00
Vladislav Sytchenko dafed1a009 Enable simpleTexture3D test for VDI
Change-Id: Ida65de6e1cae64ac97b624eaab1340877a6fba73
2020-03-13 18:34:39 -04:00
Saleel Kudchadker f663c93cd6 libhiprtc.so needs to be installed in DEST dir
Change-Id: I3ae8b4f18a05a707b87fa73873c1721928ebe904
2020-03-12 12:23:36 -07:00
Jiabao Xie f81175c3bc Cleaned include statements and deleted unnecessary operator overloads
Change-Id: I5eb322c05082e8f27584446af2f6a19243dc63c9
2020-03-12 14:13:01 -04:00
Saleel Kudchadker 7d86f10c3c Merge "Fix P4 linux make builds" into amd-master-next 2020-03-11 16:17:18 -04:00
Jiabao Xie 214c07a5b8 Merge "Structs expanded to print struct information than address. Moved to hip_formatting.hpp. Reformatted to follow Google standards" into amd-master-next 2020-03-10 15:56:49 -04:00
Yaxun Liu 3fbd8e0dc2 Merge "Let hipcc not pass -mllvm option to HIP-Clang on Windows" into amd-master-next 2020-03-10 14:12:06 -04:00
Vladislav Sytchenko caea3f9b32 Fix typo in device __shfl_xor function
Change-Id: I8bcdd53ced00c596a0af013a0c34e37aa67c93ae
2020-03-10 13:23:08 -04:00
Jiabao Xie 10d90ab2ad Structs expanded to print struct information than address. Moved to hip_formatting.hpp. Reformatted to follow Google standards
Change-Id: I08695058c11db51b9f3cbe1deb4af944ebf9e64d
2020-03-10 13:12:28 -04:00
Yaxun (Sam) Liu e796a1ed78 Let hipcc not pass -mllvm option to HIP-Clang on Windows
Currently there is a clang bug on Windows causing duplicate -mllvm options in clang -cc1.

Tempoarily disable -mllvm options for HIP-Clang on Windows until the bug is fixed.

Change-Id: I3a4393ba7745989398dc6c6001722837dad18704
2020-03-10 13:07:26 -04:00
Saleel Kudchadker 7bba326ed1 Fix P4 linux make builds
Change-Id: I6cc4e69a914389b53bc3b52535eb6faf24897a09
2020-03-10 00:02:10 -07:00
Saleel Kudchadker 8d05d06dce Merge "Change HIPRTC Version to 9.0" into amd-master-next 2020-03-09 22:55:27 -04:00
Vladislav Sytchenko 305e4eedcf Merge "Add hipDrvMemcpy3D." into amd-master-next 2020-03-09 18:13:16 -04:00
Julia Jiang 9b436779e4 Merge "SWDEV-225337-Fix test failure in hipNormalizedFloatValueTex kernel" into amd-master-next 2020-03-09 16:58:10 -04:00
Vladislav Sytchenko cd76eb7486 Add hipDrvMemcpy3D.
This is the equivalent of cuMemcpy3D.

Change-Id: Ib2e06dbd6f5093c931cdfd36c87617f32acffc2d
2020-03-09 16:11:25 -04:00
jujiang 09d442d7c3 SWDEV-225337-Fix test failure in hipNormalizedFloatValueTex kernel
Change-Id: I3a4c3b58578703993640a8d28242ec1a0ed5ff60
2020-03-09 15:21:29 -04:00
Sameer Sahasrabuddhe 5fc32755b7 enable hostcall tests
Change-Id: Ic6efe71c868defc53be214acd7e0907109ec1410
2020-03-09 14:41:37 -04:00
Saleel Kudchadker f34d5bdfb1 Change HIPRTC Version to 9.0
Change-Id: I7e88df61248f0fe6e33c2315805f9e49a493cf29
2020-03-09 11:28:55 -07:00