Граф коммитов

4785 Коммитов

Автор SHA1 Сообщение Дата
Vladislav Sytchenko fd286a205b 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


[ROCm/clr commit: 78f7954765]
2020-03-18 18:15:17 -04:00
Vladislav Sytchenko fadfaf9c80 Program texture flags in a better way
Not sure what I was thinking when initially implementing this...

Change-Id: Ib82f0f5a86683c08823dd4b59c98259d27151822


[ROCm/clr commit: ea7170d33c]
2020-03-18 18:15:09 -04:00
Vladislav Sytchenko b2e593fc62 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


[ROCm/clr commit: 8083935855]
2020-03-18 18:15:01 -04:00
Vladislav Sytchenko 42f9702627 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


[ROCm/clr commit: 53dd6b7a66]
2020-03-18 18:14:53 -04:00
Vladislav Sytchenko 5dc14caf87 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


[ROCm/clr commit: 42b149fe3c]
2020-03-18 18:14:45 -04:00
Vladislav Sytchenko 6f93cfe58e Correct the definition of ...
hipBindTextureToMipmappedArray()

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

Change-Id: I6d31204c7f2325a5bc1e8b6e089fd9f8d21d1d78


[ROCm/clr commit: 9731b61a60]
2020-03-18 18:14:36 -04:00
Vladislav Sytchenko 39c78589e2 Correct the declaration of hipBindTexture2D()
The texture reference needs to be passed as a constant pointer.

Change-Id: Idde461f0f328ac87ce677b6bab3203161b514cbf


[ROCm/clr commit: 7a81e55de7]
2020-03-18 18:08:23 -04:00
Vladislav Sytchenko 77867d5700 Correct the declaration of hipBindTextureToArray()
The texture reference needs to be passed as a constant pointer.

Change-Id: Iff171626536071fb2020cfff7132ec930577b1b9


[ROCm/clr commit: 7765792a42]
2020-03-18 18:08:13 -04:00
Vladislav Sytchenko 900f2a76c0 Correct the declaration of hipBindTexture()
The texture reference needs to be passed as a constant pointer.

Change-Id: I36ca0bddaba30becfc2ce70dd9e5b7db66c57f27


[ROCm/clr commit: 600b1006c8]
2020-03-18 18:08:01 -04:00
Vladislav Sytchenko 415070fbfc Add missing mipmap API entries
Introduce hipFreeMipmappedArray(), hipMallocMipmappedArray() and hipGetMipmappedArrayLevel() APIs.

Change-Id: I878228c79fa1c54536c17d6baf45f83d51d2b1c7


[ROCm/clr commit: 6ff0d15a62]
2020-03-18 18:07:45 -04:00
Vladislav Sytchenko 762d6f3212 Don't hardcode the texture read mode
The readmode needs to be inferred from the template arguments.

Change-Id: I067037035e2492a24eac47e16d4015f879be0ea7


[ROCm/clr commit: b4b05e2ab0]
2020-03-18 18:07:33 -04:00
Vladislav Sytchenko b255d351b0 Merge "Start the lifetime of the texture reference" into amd-master-next
[ROCm/clr commit: da5f852cdd]
2020-03-18 18:07:24 -04:00
Jiabao Xie 7c5db60141 Merge "Cleaned include statements and deleted unnecessary operator overloads" into amd-master-next
[ROCm/clr commit: bbfba3bae1]
2020-03-18 14:37:19 -04:00
Vladislav Sytchenko 84ba26979a 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


[ROCm/clr commit: b4a0008b36]
2020-03-18 12:30:11 -04:00
Vladislav Sytchenko ebd1dec272 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


[ROCm/clr commit: 8667e21b25]
2020-03-18 12:24:40 -04:00
Vladislav Sytchenko 8b211978a7 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


[ROCm/clr commit: a994da8af6]
2020-03-18 12:24:40 -04:00
Sarbojit Sarkar bfc7d1c663 Merge "[hip-vdi]Fix for TF build failure [SWDEV-225827]" into amd-master-next
[ROCm/clr commit: 4cd02f20cf]
2020-03-18 11:52:46 -04:00
Evgeny Mankov 677f9a3eb7 [HIPIFY][perl] Fix missed sync with hipify-clang
[ROCm/clr commit: 758b3864b7]
2020-03-18 14:24:02 +03:00
Evgeny Mankov a82c69da48 [HIPIFY][SPARSE] sync with hipSPARSE's "added csrsm2" (#83)
+ https://github.com/ROCmSoftwarePlatform/hipSPARSE/pull/83
+ Update doc and hipify-perl accordingly


[ROCm/clr commit: 126ebadcc6]
2020-03-18 13:44:50 +03:00
Jatin Chaudhary b77ba57b22 Merge "Enable saxpy Test" into amd-master-next
[ROCm/clr commit: d32802a176]
2020-03-18 06:32:05 -04:00
Evgeny Mankov be4ba44d12 [HIPIFY][SPARSE] sync with hipSPARSE
+ Update doc and hipify-perl accordingly


[ROCm/clr commit: baa0c68ab4]
2020-03-18 13:07:46 +03:00
Nagy-Egri Máté Ferenc f3c3070404 Remove debug message (#1950)
[ROCm/clr commit: b519d1d681]
2020-03-18 11:20:53 +05:30
Aryan Salmanpour 1c8dc380bc [HIP] use markers to sync cooperative and normal queues (#1948)
[ROCm/clr commit: 66735bff13]
2020-03-18 11:20:43 +05:30
Yaxun (Sam) Liu 5fffd89ae8 Workaround for libc++ include path for HIP-Clang (#1917)
HIP-Clang cuda_wrapper headers require clang include path before standard C++ include path.
However libc++ include path requires to be before clang include path.
To workaround this, we pass -isystem with the parent directory of clang include
path instead of the clang include path itself.

[ROCm/clr commit: 0307ae4c9a]
2020-03-18 11:20:21 +05:30
jglaser 76759ae09f Implement accurate max block size in hipFuncGetAttributes() (#1676)
This PR takes ensures that the maxThreadsPerBlock returned by hipFuncGetAttributes is both a multiple of the warp size and that the register usage of the maximum block does not exceed the number of available registers.

Fixes #1662

[ROCm/clr commit: ea28d64297]
2020-03-18 11:20:06 +05:30
Paul Fultz II 85fdd5afc9 Add missing flags for hip::device target on hip-clang (#1230)
This adds the missing compilation flags to hip::device so it can compile with hip-clang compiler.

[ROCm/clr commit: 9a47358324]
2020-03-18 11:18:58 +05:30
Sarbojit Sarkar 7cac7ff3b5 [hip-vdi]Fix for TF build failure [SWDEV-225827]
Change-Id: I8478779bef92bad8353b8d066b28c220bb59b98d


[ROCm/clr commit: 957caff8b4]
2020-03-17 22:52:01 -04:00
Vladislav Sytchenko 84a6c0001d Enable simpleTexture2DLayered test for VDI
Change-Id: I420f68824c6825152ac50e5a129b11b6ad88deb9


[ROCm/clr commit: 3150e1ef8d]
2020-03-17 17:50:46 -04:00
Vladislav Sytchenko 76b3ece656 Enable hipNormalizedFloatValueTex test for VDI
Change-Id: Iac8631312f34821d919b69b3fcb92b9387ba31dd


[ROCm/clr commit: 8d01fad7ef]
2020-03-17 17:50:30 -04:00
Tao Sang 7cfb4bac80 Merge "Fix failure to get global variables" into amd-master-next
[ROCm/clr commit: b0defd2676]
2020-03-17 17:08:14 -04:00
Vladislav Sytchenko 8d204f649e 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


[ROCm/clr commit: 3d7945faae]
2020-03-17 17:04:37 -04:00
Vladislav Sytchenko 364377eda0 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


[ROCm/clr commit: 3abd89925a]
2020-03-17 17:04:17 -04:00
Saleel Kudchadker cbaa4b75b2 Merge "libhiprtc.so needs to be installed in DEST dir" into amd-master-next
[ROCm/clr commit: 36a07434ea]
2020-03-17 16:17:55 -04:00
Tao Sang 7a171f28c7 Fix failure to get global variables
Implement _ihipGetGlobalVar() and ihipGetGlobalVar() to
get global variables.

Change-Id: I442ab6712e12306c3316f114f5dc42f6daefaad9


[ROCm/clr commit: 8e9e6a44a4]
2020-03-17 16:14:16 -04:00
Evgeny Mankov 0d11749db2 [HIPIFY][doc] Update README.md: LLVM 10.0.0-rc4 is supported
[ROCm/clr commit: 7f51cdb9da]
2020-03-17 18:51:46 +03:00
Vladislav Sytchenko 0c7735ad28 Merge "Enable simpleTexture3D test for VDI" into amd-master-next
[ROCm/clr commit: 7da159bac2]
2020-03-17 11:41:05 -04:00
Jatin Chaudhary 6d39b6fbb8 Adding Half Abs APIs (#1902)
[ROCm/clr commit: 8a3ce17ba6]
2020-03-17 14:13:19 +05:30
zhaozhangjian 02ab8feabd fix a bug when initializing a vector of hipFunction_t (#1949)
[ROCm/clr commit: a2281268ba]
2020-03-17 14:05:07 +05:30
Sameer Sahasrabuddhe 4d9df4192e enable HCC printf when using hip-clang (#1947)
This allows printf to work with hip-clang and HCC runtime. See comments under #1919 for a reported bug and feature request.

[ROCm/clr commit: 446a9e82e2]
2020-03-17 14:03:27 +05:30
Joseph Greathouse 7adeaffd61 Fix compiler warning on NVCC path (#1942)
GCC emits a warning about using static functions like
hipCUDAErrorTohipError inside this function, because it has an
inline directive, but it's not static. Adding static to this function
to silence warnings (and prevent potential problems in the future).

[ROCm/clr commit: dc9ecf03f8]
2020-03-17 14:02:59 +05:30
Joseph Greathouse 43c687a5e8 Fix occupancy calculations API on NVCC (#1941)
NVCC warned if you tried to use hipOccupancyMaxActiveBlocksPerMultiprocessor
because when passing in a device function pointer, "const void* func" was
insufficient to describe it accurately. Adding a C++ templated class type
definition for this function.

[ROCm/clr commit: 7f49e47217]
2020-03-17 14:02:48 +05:30
Reshabh Sharma 278168800f Output file name should not change flags picked for compiler (#1938)
Fixes SWDEV-207362,

The output file name should not contribute to picking up the right flags for the compiler. This fix solves issues when the output has conflicting extensions which confuses hipcc to treat them as the source files and add the required flags for them.

PS: Output file refers to the file followed by -o

Example: hipcc test.o -o test.hip will add the flags for .hip compilation ignoring the fact that it is an output file

[ROCm/clr commit: 59b8dabbd0]
2020-03-17 14:02:14 +05:30
Sarbojit2019 8e7109d9ee Fix __sad signature match with Cuda (#1936)
Fix for issue #1930

[ROCm/clr commit: 5ddb9e1eb7]
2020-03-17 14:02:00 +05:30
Joseph Greathouse 37e78fe08d Fix detection of support for cooperative groups (#1932)
Query ROCr to see if we have the proper lower-level support for
cooperative groups -- GWS support through the firmware, driver,
thunk, and ROCr. ROCr does these checks for us, and presents a
query that allows us to see if GWS entries are available for use.
If so, then we have all the lower-level technologies needed, and
we should enable cooperative groups support for HIP.

[ROCm/clr commit: 35a68596f9]
2020-03-17 14:01:44 +05:30
Reshabh Sharma 10b1f2badf Don't force compiler to treat libhip_hcc.so as a text file (#1931)
Fixes SWDEV-226025,

Right now -x c++ can come before libhip_hcc.so which forces the compiler to treat libhip_hcc.so as a text file and generates a lot of gibberish unicode. This PR changes the order of flags ensuring that -x c++ and similar flags come after libhip_hcc.so
Hopefully, this will not have any negative side effect.

[ROCm/clr commit: 4a9793e2e2]
2020-03-17 14:01:33 +05:30
Aryan Salmanpour 518130a0b7 [HIP] add cooperative kernel launch APIs on NVCC (#1929)
[ROCm/clr commit: e509a6d0b4]
2020-03-17 14:01:11 +05:30
Joseph Greathouse e1123ce997 Fix maxSharedMemoryPerMultiProcessor attribute (#1927)
The maxSharedMemoryPerMultiProcessor attribute is meant to describe
the number of bytes of shared memory (LDS space in AMD terminology)
in each SM (CU in AMD terminology). For instance, on AMD GPUs this
is often 64KB per CU, and some Nvidia GPUs it's 96KB per SM.

This shared memory is a different address space from the normal
global memory. However, the current HIP-HCC properties fill this
in with a size that matches the totalGlboalMem property. This gives
a drastically too-high calculation for the amount of LDS space that
each CU has -- tens of GBs vs. 10s of KBs.

This patch fixes this by pulling the maxSharedMemoryPerMultiProcessor
property from the HSA pool that describes how much workgroup-local
space is available on each CU. The HSA runtime eventually pulls
this from the topology information about LDSSizeInKB, defined as
"Size of Local Data Store in Kilobytes per SIMD".

Previously, this HSA query was used to fill in the value of the
sharedMemPerBlock property. On today's AMD GPUs, we know that
the amount of LDS avaialble to the workgroup is identical to the
amount of LDS space in the CU. However, in the future this may
differ. As such, this patch changes around the order and fills
in the "PerMultiProcessor" property from the HSA query (since
what's what the query is defined to return), and then separately
fills in the "PerBlock" property as we know it.

[ROCm/clr commit: 44b16df84f]
2020-03-17 14:00:51 +05:30
Joseph Greathouse 04ead59f0b Fix errors in occupancy calculation function (#1926)
Fix two errors in hipOccupancyMaxActiveBlocksPerMultiprocessor.
1) Fix a possible segfault if the user passed in a null pointer for
   the numBlocks value.
2) Handle the situation when the user is asking for a block size
   that is larger than what the target device can hold within a
   single block.

[ROCm/clr commit: 6ae1b1a321]
2020-03-17 14:00:38 +05:30
Yaxun (Sam) Liu 586dc598b6 Let hipcc not pass -mllvm option to HIP-Clang on Windows (#1924)
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

[ROCm/clr commit: 6b1956d139]
2020-03-17 14:00:20 +05:30
Maneesh Gupta 91546b6c9f Annotate __constant__ (#1901)
[ROCm/clr commit: e8bd9768d1]
2020-03-17 13:59:44 +05:30