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

1097 Коммитов

Автор SHA1 Сообщение Дата
Yaxun (Sam) Liu 8d83e95457 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
2020-04-14 16:07:14 +05:30
Yaxun (Sam) Liu 88304c15e6 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
2020-04-13 23:01:31 -04:00
Vlad Sytchenko f311b0062f Fix Windows build
Change-Id: I8c46c8ee82a6e47483d4c0430b483eead3772e5b
2020-04-10 22:25:04 -04:00
Maneesh Gupta 2af31479e2 Merge branch 'amd-master' into amd-master-next
Change-Id: I3094c15008093f2072bcd38aca4ea90aeae2d97b
2020-04-09 06:31:00 -04:00
Michael LIAO a48b312aa9 [hip] Fix volatile-qualified member function declartion.
- It should be a volatile-qualified member function instead of returning
  volatile type.

Change-Id: Id7aaa1953d56151b59e469ef22b9f4280f63bebb
2020-04-07 12:49:26 -04:00
Rahul Garg ba8a556ea9 Rename hipDrvOccupancy to hipModuleOccupancy and match CUDA syntax (#1943) 2020-04-07 14:02:52 +05:30
German Andryeyev 5fe91ccb1b SWDEV-184710
Support hipLaunchCooperativeKernelMultiDevice()

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

Change-Id: Iccca7fde43493fc3bc6685512d39202271ae3e92
2020-04-06 16:38:27 -04:00
lmoriche 9de5e90ab5 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.
2020-04-06 15:37:35 +05:30
ansurya 770e76e752 Initial support for bfloat16 (#1980) 2020-04-06 15:35:43 +05:30
Yaxun (Sam) Liu 4af2106d10 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
2020-04-06 15:35:18 +05:30
Vladislav Sytchenko aea688b79c 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
2020-04-01 14:51:51 -04:00
Michael LIAO b72196613a [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
2020-03-31 00:26:53 -04:00
Maneesh Gupta cbc3d1713f 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
2020-03-28 17:28:33 +05:30
Sameer Sahasrabuddhe 9a0c5d0653 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
2020-03-28 00:18:21 -04:00
Siu Chi Chan 43abf84f54 don't expose symbols from code_object_bundle (#1971)
Change-Id: I56479485aad42c3d517fe6d9055be1cd846eeb00
2020-03-27 14:09:07 +05:30
Vladislav Sytchenko e0187ba405 Add initial entry points for mipmapped array API
Change-Id: Icd59cc7323ddcb6773da6105260415a1e6f4cdcb
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko 2028b6eb29 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
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko ced0582a52 Set textureObject to nullptr
This avoids dangling pointers for newly initiazlied textures

Change-Id: Ia444b91fe17fd756ed583ec595ae1febbdfbd034
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko b09fe1280e Correct typos in texture function declarations
Change-Id: I492995e984eda2e8a5e806c5d4c9c78da09ac483
2020-03-26 12:43:17 -04:00
Sarbojit2019 5024f9057a Fix for __usad issue (#1972)
Fixes #1930
2020-03-26 17:09:44 +05:30
Benjamin Sherman 3d38135ae2 Add const qualifiers to HIP_vector_type unary arithmetic operators (#1965)
Resolves issue #1960
2020-03-26 17:09:00 +05:30
Joseph Greathouse f61b79d9a3 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
2020-03-25 14:39:24 -07:00
Nick Curtis b4c69a2e4a Update hip_runtime_api.h (#1966)
Correct URL for deprecated api list
2020-03-23 10:16:24 -07:00
Vladislav Sytchenko 4829a7c215 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 5429b40afe 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 3e460ab514 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 2d77399747 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 7190fa518e 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 551bcc6293 Add missing mipmap API entries
Introduce hipFreeMipmappedArray(), hipMallocMipmappedArray() and hipGetMipmappedArrayLevel() APIs.

Change-Id: I878228c79fa1c54536c17d6baf45f83d51d2b1c7
2020-03-18 18:07:45 -04:00
Vladislav Sytchenko 99e744ab4a 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 117f0ab102 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 ef2415edc7 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
Yaxun (Sam) Liu 08d9759eba 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.
2020-03-18 11:20:21 +05:30
Sarbojit Sarkar 82926666c4 [hip-vdi]Fix for TF build failure [SWDEV-225827]
Change-Id: I8478779bef92bad8353b8d066b28c220bb59b98d
2020-03-17 22:52:01 -04:00
Vladislav Sytchenko a0751402d8 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
Jatin Chaudhary 16a6a94fbf Adding Half Abs APIs (#1902) 2020-03-17 14:13:19 +05:30
Sameer Sahasrabuddhe 899c878703 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.
2020-03-17 14:03:27 +05:30
Joseph Greathouse f7e85649f4 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).
2020-03-17 14:02:59 +05:30
Joseph Greathouse 4128d68ed7 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.
2020-03-17 14:02:48 +05:30
Sarbojit2019 320742e8a0 Fix __sad signature match with Cuda (#1936)
Fix for issue #1930
2020-03-17 14:02:00 +05:30
Aryan Salmanpour 015895a265 [HIP] add cooperative kernel launch APIs on NVCC (#1929) 2020-03-17 14:01:11 +05:30
Maneesh Gupta eee5cc8621 Annotate __constant__ (#1901) 2020-03-17 13:59:44 +05:30
mhbliao 774035d869 [hip] Improve the portability of the header for vector type support. (#1873)
- Need to check the availability of `__has_attribute` builtin macro
  instead of compiler versions. That's more reliable and portable among
  various compilers.
- Provides a very basic support of vectors for unknown compilers.
2020-03-17 13:59:24 +05:30
Sameer Sahasrabuddhe 64cd527335 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
Evgeny Mankov 70f5646f8a Merge pull request #1908 from asalmanp/prop_mulit_coop
[HIP] add hip specific properties for cooperative kernel multi device
2020-03-12 19:12:11 +03:00
Alex Voicu 1c5f526e6b Merge branch 'master' of https://github.com/ROCm-Developer-Tools/HIP into feature_robust_constant 2020-03-12 14:20:26 +00:00
Maneesh Gupta 0726abf424 Expose support for non-returning atomic FADD (#1909)
Change-Id: If5359488324477315a9bd4f308a75f606c065b39
2020-03-11 14:33:15 +05:30
Vladislav Sytchenko 4ca9cda372 Fix typo in device __shfl_xor function
Change-Id: I8bcdd53ced00c596a0af013a0c34e37aa67c93ae
2020-03-10 13:23:08 -04:00
Nick Curtis 09edc7e49c Fix incorrect shfl_xor for Windows
copy/paste error, need __shfl_xor w/ lane_mask
2020-03-10 12:04:05 -05:00
Vladislav Sytchenko ecd7c99b49 Add hipDrvMemcpy3D.
This is the equivalent of cuMemcpy3D.

Change-Id: Ib2e06dbd6f5093c931cdfd36c87617f32acffc2d
2020-03-09 16:11:25 -04:00