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

2959 Коммитов

Автор SHA1 Сообщение Дата
Amber Lin 2a50ebba98 Allow a memory to be registered multiple times
A memory region is allowed to be registered multiple times when the memory
is specified by a user pointer. If it's registered with the same user
pointer but with different sizes, it's treated as different instances and
multiple VM objects are created with different GPU address.


Change-Id: I49627111bb5db36d18f1133b252fb62a611f06a4
2016-11-18 17:46:12 -05:00
Yong Zhao a1f417715b Making the code more robust by checking the NULL pointer
Change-Id: I36b9f73eadd7547c71fe3641ac131c7408b14816
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2016-11-16 11:35:26 -05:00
Sean Keely 8081758a55 Add InterProcess memory sharing support.
Support is disabled pending KFD / Thunk readiness.

Change-Id: I55def748e3d56cbfcfa6e24983a0ab78567aa81d
2016-11-15 18:58:29 -06:00
Sean Keely 9dd76dbeda Add pointer info support.
Change-Id: I3edcc0bfddbf12465065c9bc3b6565288faff1b8
2016-11-11 18:40:16 -06:00
Sean Keely e01c43578c Restrict stack usage in interop map to a more reasonable level.
Change-Id: I663f262a391d1e7f8a6fc3028ea9acbe37d8bcf0
2016-11-10 16:55:55 -06:00
Sean Keely c54c63fd56 Set the default value of userdata in pointer info to NULL.
Change-Id: Ie0d94b921bbce880d9548d5a014a2d7c33062f7e
2016-11-09 21:15:07 -06:00
Konstantin Zhuravlyov 54245e064c Allocate only one segment for code object v2+
Change-Id: I7cd03b5c205d3ea5735f8f29820867ca90ac081b
2016-11-03 09:51:11 -04:00
Andres Rodriguez 0de39b6724 Fix hsaKmtOpen incorrectly doing nothing in some fork scenarios
Currently, if a process' parent called hsaKmtOpen, the child will be
unable to open a connection to KFD, since kfd_open_count will be > 0.

When forking, the refcount should be reset, in order to allow the child
to re-open /dev/kfd.

Change-Id: Ia4b78f6bacc4f82e8ac724e5f488a3eff5084007
2016-11-01 15:54:17 -04:00
Chris Freehill 30f1ec2691 Added support for agent attribute HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU
Change-Id: I2b90e7165384c4dce928a620a1782395267b35b0
2016-10-28 11:24:21 -04:00
Jay Cornwall c30c25bd30 Fix miscellaneous warnings flagged by Clang
Change-Id: I85a45cb3b44e4379b31bcc56af061fd1571f2af5
2016-10-26 19:26:16 -05:00
Jay Cornwall d5b4078072 Insert explicit memory fence before submitting doorbell
Ensure that the write index and ring buffer contents are visible
to the HW before sending the doorbell. The latter is a write-combined
MMIO store and must be ordered with prior cacehable non-MMIO stores.

Also be more explicit about memory semantics for doorbell stores.

Change-Id: Ie4d96a7ee2a507237a8dbe7705fdf234d62ce9ba
2016-10-17 10:01:47 -04:00
Jay Cornwall c83846cd45 Fix AQL packet lookup in dynamic scratch event handler
Read index was not wrapped correctly.

Change-Id: I25c901b61e4760990871e22468ffd0391abef244
2016-10-17 10:01:14 -04:00
James Edwards d66af9718e Fix hsa-runtime-tools library dependencies.
Change-Id: I649ebde06ab5c4b1892968c22e44c2bd5f53e49b
2016-10-15 14:35:44 -05:00
James Edwards 4b6feb8498 Fix library namespace to ROCR_1.
Change-Id: Ie341203bad8e17673be86529bfed3c4fa98e9343
2016-10-13 16:26:46 -05:00
Konstantin Zhuravlyov 6f216f30c2 Initialize symbol's agent member for agent allocation symbols
Change-Id: I0ee0e07e4132ca13b3ecf7469c59ca327ff3c76d
2016-10-13 12:43:19 -04:00
Jay Cornwall 5493ae420b Disable GPUVM-mapped doorbell on gfx802
gfx802 requires a workaround for a VM TLB bug in which lookups use
the ACTIVE bit of the 8th PTE within any aligned group of 8 PTEs.
Until this is fixed in amdgpu the GPUVM doorbell logic will fail.

Change-Id: I5ec7b1fcd8b7677011a141d27cfc486c45d9a415
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
2016-10-10 18:39:31 -05:00
James Edwards 070be8823f Modify image libraries CMakeLists.txt file to use HSAKMT variables.
Change-Id: I19f1c4a312b108774f2e3e9c6697db07e6731556
2016-09-30 23:05:38 -05:00
James Edwards b170e0ad8c Fix CMakeList.txt file to use correct compile options. Fix compilation errors.
Change-Id: I6229a83d0823ee7a123cdaa9efd782108aa3a03c
2016-09-30 16:36:01 -05:00
James Edwards cfc949c1ee Update required cmake version to 3.5.1 to support rpm packages.
Change-Id: Ic8d0d96b131937407de2578a653025a44843d330
2016-09-30 16:04:02 -05:00
James Edwards 1b30c322f0 Remove unneeded CMakeList.txt file. Move link and def files.
Change-Id: I219317496aa564bde488a8e56e7d83808ebddb66
2016-09-30 13:02:30 -05:00
James Edwards 41432ee6ca Fix Teamcity build break, part 1.
Change-Id: I2019b502700e5fda2175b258dcfd3681ab93bc77
2016-09-29 18:41:54 -05:00
James Edwards 809356e0b5 Update runtime CMakeLists.txt and utility files to support top level CMakeLists.txt build.
Change-Id: I4a0eb512af82908a24f2d1964b201c28023ccae5
2016-09-27 11:58:31 -04:00
Christophe Paquot 5519c96b74 Sync needed when wrapping around the kernel arg buffer
If we issue too many copy commands without syncing and wrapping happens,
we need to wait for the blits to be done before moving forward otherwise
we will overwrite the kernel args of the blits in flight.

Change-Id: I9a21e31ce07f8e8157ca38e96dc264ff47fd3639
2016-09-26 14:14:33 -04:00
James Edwards fddd5246f3 Update rocr packaging CMakeList.txt files to PACKAGE and LIBRARY versioning. Also, fix support for rpm packaging.
Change-Id: Iff41df41ea78b7d1248164ce3f587ad34a8865a5
2016-09-23 19:12:19 -04:00
Ramesh Errabolu 5d972064c1 Support a new property of Rocr Agents called Product Name
Change-Id: Ia7217094223bfed908d9aa9ccdaa590e785503cb
2016-09-21 17:00:41 -04:00
James Edwards 7511631f08 Add libhsakmt cmake build and packaging files.
Change-Id: Ic7fa22d5b266480aa0c62628022f39da4e043d23
2016-09-20 17:48:36 -04:00
James Edwards b4fedf6785 ADD copy_targets targets to ALL target
Change-Id: I3d4b28f873f09a9e866d9f27f0bdfd3c65494e6f
2016-09-20 13:50:06 -05:00
Felix Kuehling 2e0a6eb371 Allocate and map doorbells in SVM for discrete GPUs
Allocate doorbells for dGPUs in the SVM aperture and map them for
GPU access. This is necessary to allow GPU-initiated submissions to
user mode queues.

Depends on new doorbell BO allocation flag in KFD.

Change-Id: I0737bef4a4764bb4a66c43846707ead2108f6601
2016-09-16 16:04:27 -04:00
Amber Lin 660a6ebbd4 Disable CPU cache info in non-x86
CPU cache information reported by Thunk topology is obtained from cpuid
instruction. This instruction only applies to X86 systems. It can cause
compile errors on non-X86 platforms. This patch temporarily disables CPU
cache functions in topology for non-X86 platforms in order to compile.

Change-Id: If86671817b0d036cb324eebf3f354682bfb75856
2016-09-14 17:30:50 -04:00
Amber Lin 4911c91389 Search VM object by range
Add vm_find_object_by_userptr_range so QueryPointerInfo can find the
object as well when the pointer is not the starting address but it's
inside the memory range. Also rename vm_find_object_xxx functions to
_by_address and _by_address_range to be consistent.

Change-Id: I5c2b3a05b41493e32b7fd9154665bf078b043606
2016-09-13 12:44:29 -04:00
Christophe Paquot 538736a660 Add tiling code
Introducing tiling format for images, still using LINEAR for now.
Using the new KFD/Thunk API hsaKmtGetTileConfig API for the address library.

Change-Id: Ic0677429dd320eef09ab62dddaf9b2dd94c4f904
2016-09-13 11:42:10 -04:00
Amber Lin 19f2676ea7 Pointer attributes on APU
Add CPUVM aperture to keep track of memory allocation that is not known
to GPU driver. Together with GPUVM, this patch adds the pointer attributes
support to APU.

Change-Id: If13f9cf01ff8b9f709b99b66661e7505246adf4c
2016-09-12 11:32:26 -04:00
Ramesh Errabolu c54304fe38 Print Debug Mesg if private segment memory request is illegal
Change-Id: I46351651b6b2bf14e26645440a4321bc941900b2
2016-09-08 11:16:09 -04:00
Amber Lin 51e4d27c37 Add pointer attributes API
Add two pointer attributes APIs:
hsaKmtQueryPointerInfo - allow the user to query the memory information
    using a pointer. This pointer can point to any address inside the
    range known to HSA.
hsaKmtSetMemoryUserData - allow the user to attach data to a pointer to
    add memory tracking information. This pointer must match the start
    address of a memory allocation or registration.
TODO: This patch implements support on dGPU. Needs to add APU.

Change-Id: I4711809274248434901f0794f50ebfa13a7371a8
2016-09-07 17:24:46 -04:00
Sean Keely 2008af1899 Add missing export of hsa_signal_group_wait_any_relaxed.
Change-Id: Ia043c72234534c1ac7c0a0518b64e244fc116157
2016-09-07 15:03:33 -05:00
Yong Zhao 8351b3d2e8 Implement hsaKmtGetTileConfig in thunk
Change-Id: Iba8d8efa46e3c268a03442d3db568e1b19230e94
2016-09-06 16:24:29 -04:00
Ramesh Errabolu 5ab5396529 Read name of Hsa Agent from a new field of Node Properties
Change-Id: I3abca521a904c40cb84d90800a16363b1ad64768
2016-09-05 14:33:08 -04:00
Sean Keely 1bc15bbf79 Switch atomic_helpers.h from C11 atomics to GCC __atomic builtins.
C11 atomics are not statically guaranteed to be lock free and so
may not be atomic with respect to atomic operations originating
outside the standard library, such as platform atomics.

C11 macros to statically discover always lock free operations
(ATOMIC_*_LOCK_FREE) do not cover uint64_t in GCC and
std::atomic<uint64_t> is not a type alias of any covered type.

All use of __atomic by atomic_helpers.h is statically checked to be
always lock free.

GCC builtin fencing does not appear to be strong enough for WC memory.
Added an option (enabled) to enforce consistency for WC memory on x64.

__sync builtin's were not used as they were declared legacy by GCC.

Added a strongly conservative option (ALWAYS_CONSERVATIVE) to enable
use of full memory fences in place of partial fences and compiler
driven processor specific optimization.

Change-Id: Id7aaaca626144070f58759f6a348cbee4612bbc0
2016-09-03 06:22:42 -04:00
Lan Xiao df593aa076 libhsakmt: Marketing Name and AMDName support for APUs
For APUs, use /proc/cpuinfo to get Marketing name.



Change-Id: I4a17516d26a092683f36631032be00ad44f7e7fe
Signed-off-by: Lan Xiao <Lan.Xiao@amd.com>
2016-09-02 15:16:18 -04:00
Konstantin Zhuravlyov 73ed2116d5 Use memcpy instead of hsa_memory_copy
Change hsa_code_object_serialize and hsa_code_object_deserialize to use memcpy instead of hsa_memory_copy since it is system->system copy

Change-Id: I329e270ae4e2fc25e177dc8080d93662ffb261ab
2016-09-01 01:56:07 -04:00
Konstantin Zhuravlyov 518da7d4e7 Purge unused variables (to silence warnings)
Change-Id: Ifc11c4bc4725f4c70d6be75208b6906d163754b4
2016-08-31 14:54:20 -04:00
Andres Rodriguez b1d2867b60 LICENSE: add X11/MIT license file
Change-Id: I2e95af843046896708bb7a116f7b03a0fa30a255
2016-08-25 16:27:46 -04:00
Andres Rodriguez e0c77a38cb Makefile: remove 32bit thunk compilation by default
Compiling in 32bit mode is broken, and we don't have an intention on
restarting compatibility with 32bit apps.

Change-Id: I5524b5b63fe62e6026aa04d84c4510e290a86106
2016-08-25 16:27:19 -04:00
Jay Cornwall 74f5aca93d Refactor: Consolidate calls to hsaKmtAllocMemory
Route all device-visible system memory allocations through system_allocator.

Change-Id: I5e90a1bf491e432678a6d8ab1f9f3770734cbda1
2016-08-24 23:57:19 -04:00
Lan Xiao 9cbbf30be7 libhsakmt: Add MarketingName and AMDName for all nodes - CPU & GPU
HSA thunk API is currently reporting engineering name to MarketingName
and returning NULL when querying for AMDName.

-Change current name reporting from MarketingName to AMDName.
-Use libpci to get MarketingName



Change-Id: I819a6de7b067a2e724a6695e7d800274b83a71f8
Signed-off-by: Lan Xiao <Lan.Xiao@amd.com>
2016-08-23 10:49:27 -04:00
Sean Keely 54f1311e01 Update clang-format file to clang-format v3.8.
Format HSA v1.1 core updates.

Change-Id: I540b5c0e5b3ec7522b09c2e070167812b3f17769
2016-08-23 05:50:28 -05:00
Kent Russell 70b1b5b17e queues.c: Enforce CUMaskCount being a multiple of 32
The thunk spec requires that CUMaskCount be divisible by 32. Check this
and return INVALID_PARAMETER if it is not.

Change-Id: I4e0c8502d996d3da31224b817a5d4ff2c6054e13
2016-08-23 06:16:39 -04:00
Jay Cornwall 0c9f96cfa4 Propagate errors from hsaKmtOpenKFD back to hsa_init
Errors are otherwise silently ignored and hsa_init completes successfully.

Change-Id: Ib1b7dbd7a65d40f869cdbb2792fa97132873d3d7
2016-08-22 17:28:48 -05:00
Ramesh Errabolu 31f64cdaab Fix Image Create Func Decl in Hsa Api Table
Change-Id: I3862b3c78231fe24b6361167a78c6a8c7ad6ce0b
2016-08-22 15:43:48 -04:00
Konstantin Zhuravlyov c2c993e0d8 Update code object/isa/loader to hsa v1.1
- Includes Sean's latest changes
- Cleanups/improvements
- Fixes for few bugs that crept over from previous releases

Change-Id: I839dc4895bf13ebd0afc8843424387a9fef667b0
2016-08-22 15:03:23 -04:00