Commit Graph

1243 Commits

Author SHA1 Message Date
Alex Xie c9e54b7f60 SWDEV-221166 - Detect support for large bar access through HIP runtime API
Change-Id: Iaa9756c1b5e40c1ab5afb38e44a6699fa5f6c13f


[ROCm/clr commit: 044a7e55ad]
2020-05-01 20:39:52 -04:00
Michael LIAO 6989a83f35 Fix more typos from 42f9702627.
Change-Id: I75ed28a5862daffc0778910d7ba3b97f51a87949


[ROCm/clr commit: 6bfedf1a1d]
2020-05-01 12:19:30 -04:00
root 6a7aa0c1c6 Merge master into amd-master-next
Change-Id: I3fc1dc0c860d627053537581e75561e8a7efe327


[ROCm/clr commit: b5031f39b1]
2020-04-26 22:19:37 +00:00
Yaxun (Sam) Liu c13a63bcff Enable template max and min for HIP-Clang (#2028)
It was for HCC only. HIP-Clang also needs it for __fp16 since AMDMIGraphX uses it.

Change-Id: Id49322b7b89ef799accdf6b47627a6fce51d1ab5

[ROCm/clr commit: 29549ce4dc]
2020-04-24 12:30:28 -07:00
Yaxun (Sam) Liu 066b79be84 Enable template max and min for HIP-Clang
This change is required by AMDMIGraphX.

It was for HCC only. HIP-Clang also needs it for __fp16 since AMDMIGraphX uses it.

Change-Id: Id49322b7b89ef799accdf6b47627a6fce51d1ab5


[ROCm/clr commit: 1013e4eca8]
2020-04-24 09:51:17 -04:00
Vlad Sytchenko 9fb3564410 Make sure to zero out all the unset texture fields
These might contain garbage causing the runtime to incorrectly parse the state of the texture references.

Change-Id: I93c726fa30b580b3e14c50ac939f3c71b0d1c8d9


[ROCm/clr commit: bfa363d00c]
2020-04-23 16:38:52 -04:00
Maneesh Gupta 11fe5b06de Merge in the rocclr based hip runtime (#2032)
* Merge master-next changes in master (include vdi development in master branch)



[ROCm/clr commit: f2e1118d7a]
2020-04-23 09:12:06 -07:00
Michael LIAO 4e3c8a5ff4 [hip] Fix typos.
Change-Id: I9d85d0e70033d144dbd4d61cb434ffbe023af8c0


[ROCm/clr commit: a353df6b36]
2020-04-22 16:44:54 -04:00
Michael LIAO 07f08b78c1 [hip] Generate assertion message in assertion.
Change-Id: Ie66f6563e8728fd0e21cf22dcc6619e4a0e5c28d


[ROCm/clr commit: 2c1933e0f3]
2020-04-21 16:44:40 -04:00
Michael LIAO f0df4418a0 [vdi] Refactor texture/surface reference support.
Change-Id: I8014d82aae7139ef5f95e4b50c4fc6da200dbc9d


[ROCm/clr commit: 441284841d]
2020-04-21 11:56:48 -04:00
Aryan Salmanpour ca51795efd disable printf on hip-clang on Windows (#2021)
[ROCm/clr commit: 08147681d0]
2020-04-17 10:33:24 +05:30
Jeff Daily 8b0a909b2b add IPC event support (#1996)
[ROCm/clr commit: e943144b31]
2020-04-17 10:31:22 +05:30
Yaxun (Sam) Liu 2406fa8a3d Disable device side malloc (#2009)
* Disable device side malloc

Currently device side malloc is not working and takes excessive
device memory.

Disable it for now until a working malloc is implemented.

Change-Id: I1ad908c1c53a83752383b4be96688a848642c699

[ROCm/clr commit: d556c3425b]
2020-04-14 16:07:14 +05:30
Yaxun (Sam) Liu aadb232c20 Fix MIOpen build failure
This is charrypick of 9ead991784
and https://github.com/ROCm-Developer-Tools/HIP/pull/2009

Fix cmake config file

Removed cmake target files under packaging directory.

Merged cmake config .in files for HIP-Clang and HCC as one.

Use cmake generated target files in both install and packaging.

This makes cmake config file consistent for make install and
make package.

Let device side malloc/free return nullptr and trap

Change-Id: I448f3ea2d4934648089bad371debc203f895cba6


[ROCm/clr commit: 4e1d05c4be]
2020-04-13 23:01:31 -04:00
Vlad Sytchenko 60ec8d6047 Fix Windows build
Change-Id: I8c46c8ee82a6e47483d4c0430b483eead3772e5b


[ROCm/clr commit: ff3c449514]
2020-04-10 22:25:04 -04:00
Maneesh Gupta e5ee180568 Merge branch 'amd-master' into amd-master-next
Change-Id: I3094c15008093f2072bcd38aca4ea90aeae2d97b


[ROCm/clr commit: 0ea6697192]
2020-04-09 06:31:00 -04:00
Michael LIAO 4fba98c2cf [hip] Fix volatile-qualified member function declartion.
- It should be a volatile-qualified member function instead of returning
  volatile type.

Change-Id: Id7aaa1953d56151b59e469ef22b9f4280f63bebb


[ROCm/clr commit: 35b001b33a]
2020-04-07 12:49:26 -04:00
Rahul Garg 63332172d6 Rename hipDrvOccupancy to hipModuleOccupancy and match CUDA syntax (#1943)
[ROCm/clr commit: 69e09a0b1b]
2020-04-07 14:02:52 +05:30
German Andryeyev abc3e6df5c SWDEV-184710
Support hipLaunchCooperativeKernelMultiDevice()

- Add validation logic for MGPU launches to pass a cuda test

Change-Id: Iccca7fde43493fc3bc6685512d39202271ae3e92


[ROCm/clr commit: 8be723e199]
2020-04-06 16:38:27 -04:00
lmoriche 318fbce04d Don't duplicate embedded code objects (#1991)
If the code object is embedded in an already mapped file, and the
lifetime of the mapped file exceeds the lifetime of the executable,
we do not need to make a copy of the binary.

This allows the ROCR to present the code object URI as
file:///path/to/file#offset=X&size=Y.

[ROCm/clr commit: 67830996a9]
2020-04-06 15:37:35 +05:30
ansurya 6b18a8e068 Initial support for bfloat16 (#1980)
[ROCm/clr commit: ff7aaedca2]
2020-04-06 15:35:43 +05:30
Yaxun (Sam) Liu ecfda14b46 Fix ambiguity of fma for _Float16 for libc++ (#1976)
libc++ defines fma as template function for auto promotion of mixed-type
arguments. libc++ does not handle _Float16 as _Float16 is not a supported
type by C++ standard. As such, it is unlikely we can commit our fix for
_Float16 to libc++ trunk.

Therefore we handle _Float16 with a template specialization of
__numeric_type in HIP headers.

Change-Id: If01960a657ebf1a7a67463cdcf66fab7458dff3c

[ROCm/clr commit: 6f439f0232]
2020-04-06 15:35:18 +05:30
Vladislav Sytchenko ee88afced4 Add entry points for hipTexObject*() API
Even though the runtime and driver texture object API is one to one, the structs used by these APIs are not. See hipResourceDesc vs HIP_RESOURCE_DESC differences.

These differences are not trivial and most likely won't be able to handled by hipify, so we need new API entry points.

Change-Id: Id4bcb1ad0ae15378dbdb5a2ed07e5ea30f320082


[ROCm/clr commit: a09fadecf2]
2020-04-01 14:51:51 -04:00
Michael LIAO dc0ddc29fe [vdi] Fix hipGetSymbol{Address|Size}
- Use symbol value as the qeury key. Compared to the symbol name, the
  symbol value is more robust as developers may use unqualified or
  qualified identifiers. It also removes the mangling and/or demangling
  requirement for the runtime API.

Change-Id: I9d4259f3842612c7cc98551269fc2092d8b5c19e


[ROCm/clr commit: a14695d4eb]
2020-03-31 00:26:53 -04:00
Maneesh Gupta 3d1b086400 Remove address_space(1) typecast and use __ockl_atomic_add_noret_f32 (#1956)
* Remove address_space(1) typecast for ockl_global_atomic_add_f32
* use __ockl_atomic_add_noret_f32

[ROCm/clr commit: 062938a14c]
2020-03-28 17:28:33 +05:30
Sameer Sahasrabuddhe 207d9b3897 enable HCC printf when using hip-clang
This is cherry-picked from PR#1947 that was committed to the
github repo. It allows printf to work with hip-clang and HCC
runtime.

Change-Id: I754753250ea1e694cf3441722e2d4c9d25fa75bc


[ROCm/clr commit: c014c733c6]
2020-03-28 00:18:21 -04:00
Siu Chi Chan 922219117b don't expose symbols from code_object_bundle (#1971)
Change-Id: I56479485aad42c3d517fe6d9055be1cd846eeb00

[ROCm/clr commit: 6ab1e864b6]
2020-03-27 14:09:07 +05:30
Vladislav Sytchenko cfc508eef0 Add initial entry points for mipmapped array API
Change-Id: Icd59cc7323ddcb6773da6105260415a1e6f4cdcb


[ROCm/clr commit: 06bb183558]
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko df2f07ce18 Headers need to export C symbols for texture API
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]
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko b7f6419f6a Set textureObject to nullptr
This avoids dangling pointers for newly initiazlied textures

Change-Id: Ia444b91fe17fd756ed583ec595ae1febbdfbd034


[ROCm/clr commit: 3ab8ff87cc]
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko c0a3cb04fe Correct typos in texture function declarations
Change-Id: I492995e984eda2e8a5e806c5d4c9c78da09ac483


[ROCm/clr commit: dc015d27c1]
2020-03-26 12:43:17 -04:00
Sarbojit2019 77f9a99ef0 Fix for __usad issue (#1972)
Fixes #1930

[ROCm/clr commit: 13b73692d8]
2020-03-26 17:09:44 +05:30
Benjamin Sherman e13788ff95 Add const qualifiers to HIP_vector_type unary arithmetic operators (#1965)
Resolves issue #1960

[ROCm/clr commit: 09ffe4365d]
2020-03-26 17:09:00 +05:30
Joseph Greathouse 8ce72c7f06 Fix cooperative launch APIs to set hipGetLastError (#1935)
* Fix cooperative launch APIs to set hipGetLastError

Previously, the cooperative launch APIs did not properly log their
errors in the global hipGetLastError variable before returning back
to the user. As such, the APIs would leave hipSuccess in the
last error, which would break some use cases.

This fixes that problem by making a trampoline function that does
the HIP_INIT_API and ihipLogStatus.

* Add missing flag to the log of multi-GPU launch

[ROCm/clr commit: 341ef7fdca]
2020-03-25 14:39:24 -07:00
Nick Curtis 57fc126456 Update hip_runtime_api.h (#1966)
Correct URL for deprecated api list

[ROCm/clr commit: bf2fcce488]
2020-03-23 10:16:24 -07:00
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 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 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 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
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
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 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
Jatin Chaudhary 6d39b6fbb8 Adding Half Abs APIs (#1902)
[ROCm/clr commit: 8a3ce17ba6]
2020-03-17 14:13:19 +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