コミットグラフ

597 コミット

作成者 SHA1 メッセージ 日付
Philip Yang 71cf3cf5d3 libhsakmt: correct number of NUMA nodes calculation
numa_max_node() return the highest node number available on the current
system, number of NUMA nodes should be numa_max_node() + 1.

Change-Id: I20a6c17af071e73e853cb5ea6d0304c8aca52681
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-09-16 16:25:57 -04:00
Philip Yang 69d8f2d734 kfdtest: use flag NoNUMABind to allocate system memory
Allocate system memory from node id 0 will fail on NUMA system which has
no memory on node 0. Change to use new flag NoNUMABind to allocate
system memory from NUMA nodes which have free memory.

Change-Id: I8ef9ca28fc2ab5dd31d07a2d3eaf1d5886e798a0
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-09-16 12:25:01 -04:00
Philip Yang 42392f093f libhsakmt: handle NUMA system with no memory on node 0
on NUMA system, node 0 may have no memory, application pass node id
0 to hsaKmtAllocMemory will fail because mbind to specify the allocation
from node 0 return EINVAL.

Add new flag NoNUMABind for application to pass it to hsaKmtAllocMemory
to skip mbind.

hsaKmtCreateEvent and hsaKmtCreateQueue specify the new flag NoNUMABind
to allocate system memory for event page and CWSR area, don't bind the
system memory to a specific NUMA node.

Change-Id: I854e5a57502c7807c4c5ff2e441d499ae515c309
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-09-16 11:30:24 -04:00
Philip Yang 4da09813a3 libhsakmt: fix mbind failed on docker
Docker seccomp by default blocks mbind system call, so mbind return
failed on docker. thunk should not fail this otherwise application
cannot allocate system memory on docker.

Use pr_warn_once and pr_err_once to avoid duplicate same error messages



Change-Id: I61a7c0e4abaa3dcfe7abf2ea48db90f669f9638a
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-09-13 15:01:47 -04:00
Yong Zhao ec1375ac66 kfdtest: Automate the gtest filter name generation
This will emilinate the need of updating the run_kfdtest.sh every time
a new platform is added.

Change-Id: I584d65b462de36a685fa2d29d43962078ba511dc
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-12 15:57:20 -04:00
Yong Zhao baa2957895 kfdtest: Add gfx1012 initial test coverage
Change-Id: I983d4dd6c17b2eaadd5abf4b71e090a14cace303
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-06 14:42:43 -04:00
Yong Zhao 3ecd83e52d libhsakmt: Support gfx1012
The gfx version item is yet to be added.

Change-Id: Ia6c487447e5a5df80c0c12fe150939175068024b
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-06 14:42:32 -04:00
Yong Zhao d6539ddc24 libhsakmt: Implement HSA_FORCE_ASIC_TYPE to overwrite asic type
Force all the GPUs to a certain type, use the below command:
HSA_FORCE_ASIC_TYPE="10.1.0 1 gfx1010 14"
meaning major.minor.step dgpu asic_name asic_id

This will faciliate the cooperation across the teams for bringing up
ASICs which reuse existing device IDs.

Change-Id: I40fe4c9b46d3ccb3e38ea52250e80e82fb50fb0f
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-06 12:12:42 -04:00
Yong Zhao 09d192802a kfdtest: Remove useless test cases
Those tests are actually did not function up to its expectation because
some underlying functions such as suspend/resume and disable/enable KFD
were not implemented. Those interfaces would never be implemented, so
delete them.

Change-Id: Ib5872ba2f35e307221e43791cda1782c6b6bb4d1
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-06 11:12:17 -04:00
Yong Zhao 9048fb5a1a kfdtest: Implement SuspendAndWakeUp()
Change-Id: I16384cd0ca35f15841344ded4d4237a0a862a934
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-09-06 11:11:49 -04:00
Felix Kuehling 01957d4da3 kfdtest: Use CoarseGrain for VRAM buffers
Change-Id: I320099e61fc8f1012184fc68c248da4e224bc3ca
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-09-04 14:45:01 -04:00
Felix Kuehling 8f91d6a222 kfdtest: Enable more tests on gfx802
A number of tests are no longer broken on gfx802.

Change-Id: If70c77423f8f14de59490ab8ca156b0c4e7b5cf1
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-30 19:06:24 -04:00
Felix Kuehling e320913e9e libhsakmt: Fix userptr mappings on gfx802
The memory size alignment workaround for a TLB bug on gfx802 was
breaking userptrs because it would attempt to get_user_pages beyond
the end of a VMA. Refine this workaround based on our understanding
of the HW bug. It only affects L2 cacheline allocation, which is
decided by the last page in the cache line (8 entries = 32KB of
address space). Thus aligning memory allocation so that the last
page falls on the end of a 8 entry TLB cache line allows caching
to work correctly.

Imported images require specific alignments. If their size is not
naturally aligned with 8 cache lines, it may have bad TLB cache
performance.

This patch will only have the desired effect if redundant size
padding in KFD is also removed.

Change-Id: I984cbe7fa61fec04d70fa387aaf9aab370eabeb9
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-30 19:06:24 -04:00
Craig Andrews ec1461b84b hsakmt-dev should not install linux kernel headers
hsakmt-dev should not install include/linux/* (currently just kfd_ioctl.h)
as those are linux kernel headers provided by the linux kernel header
packages (`linux-headers-*` on Debian/Ubuntu or `kernel-headers-*` on
Red Hat / Fedora)

Change-Id: Ib6e62ca2f3582c5ad7351225f5827081bf8e05c0
Signed-off-by: Craig Andrews <candrews@integralblue.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-29 19:22:47 -04:00
Craig Andrews eebbb5a0ea Install libhsakmt.pc to the standard location
pkgconfig files should be installed to /usr/share/pkgconfig/, not /usr/libhsakmt/

Change-Id: Ifd08f612addb375de1d00282ee9e7c257528bf74
Signed-off-by: Craig Andrews <candrews@integralblue.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-29 19:22:47 -04:00
Craig Andrews 6c9a49076a Install LICENSE.md to DOCDIR
LICENSE.md should be installed to the DOCDIR, not /usr/libhsakmt

Change-Id: I2020547b3174b9d91c1f800d9db2d73f627a6ce3
Signed-off-by: Craig Andrews <candrews@integralblue.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-29 19:22:47 -04:00
Felix Kuehling 8f9f9a47ff kfdtest: Use hsakmt header files from source tree
Instead of the installed hsakmt header files, use the ones from the
source tree, since they are in the same git repository. This allows
using kfd_ioctl.h even when we don't install this file with an
upcoming change.

Change-Id: I9a30abd5445806d2141bdb1ccd88d3794a74ed20
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-29 19:22:47 -04:00
shaoyunl c7a946dd5d KFDTest: Add gfx1010 support in KFDTest script
Change-Id: I3c7132c73c68139677259aa57ea0b443ed664c14
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
2019-08-29 18:59:15 -04:00
Lad, Aditya cabebaa091 Support for SLES on thunk
Made changes in the CMakeLists.txt
1) Detects the OS of the system
2) Accordingly setsup the runtime dependencies

Change-Id: Ief9a0217caae77d4be4850167e2a9b8387f639e4
Signed-off-by: Lad, Aditya <aditya.lad@amd.com>
2019-08-29 14:06:55 -04:00
Jack Zhang 545ca6263f add device ID for gfx908 VF
SRIOV: Fix issue that kfdtest cannot
detect gfx908 VF inside VM.

Change-Id: Ie05fd66d4e14b47818fddbe404df1059567b76a2
Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com>
2019-08-29 15:29:34 +08:00
Yong Zhao dbe9af7777 libhsakmt: Improve the confusing code
The code tends to confuse readers. Improve it.

Change-Id: I5c6cbf7a114b6e7d26ce3b9f54350a153032267d
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-28 18:43:24 -04:00
Kent Russell ccac07cb14 topology: Fix compile warnings regarding snprintf and path
snprintf throws a warning from -Wformat-truncation where the string
could be truncated. We address this by referencing the maximum size that
can be returned from a file according to MAXNAMLEN . This should safely
guard us from truncating the path value.

Change-Id: If1d208990d8775e9494835b0deb890d2616fd15b
Signed-off-by: Kent Russell <kent.russell@amd.com>
2019-08-27 11:06:06 -04:00
Sean Keely 8ab8b14902 Initialize dirp in topology_create_temp_cpu_cache_list to NULL.
Avoids uninitialized use in early exit (error) paths.

Change-Id: I5fb24863f0a5da48776608d47f25e1c8d8aafe35
2019-08-27 00:37:05 -05:00
Amber Lin 4fa930af5a libhsakmt: get cpu cache info from sysfs
Replace cpuid call with sysfs data to get CPU cache information. With this
change, x86 check is also removed since sysfs applies to other platforms.
CPU cache information can be retrieved from
/sys/devices/system/node/nodeX/cpuY/cache where Y is processor number
represented in /proc/cpuinfo at "processor" entry.

Change-Id: Ic47df6d5dafaf1aae5b46b1fdee42691c697e49e
Signed-off-by: Amber Lin <Amber.Lin@amd.com>
2019-08-26 14:52:01 -04:00
Ori Messinger f2173254e4 Report domain with HsaNodeProperties
PCI domain has moved to 32-bits to accommodate virtualization,
so a 32-bit integer is exposed for domain to reflect this change.

Change-Id: I0d767acadcdc8e4277db203b5865dd67dd001cef
Signed-off-by: Ori Messinger <ori.messinger@amd.com>
2019-08-23 11:59:19 -04:00
Jonathan Kim 1ff5cb33b2 add new queue bit test on clear event
enable thunk query api to report if queue is newly created
test new queue bit test on clear events.
also fixup cleanup to disable debug trap.

Change-Id: I3ebe2d85da66f28b8c82f0e68461ee7d32ec0b0d
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Philip Cox <Philip.Cox@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-23 11:25:32 -04:00
Jay Cornwall 814e0f0bdc Reserve 128 SGPRs per wave in context save area
Originally reserved 100 SGPRs per wave. Pre-gfx10 needs 102 SGPRs
and gfx10 needs 128 SGPRs. Reserve 128 SGPRs per wave for all ASICs
to simplify calculation.
Also double VGPR register size for gfx908 family

Change-Id: I98b741cbfa051f49ed37ff25d99f851f124be7b6
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
2019-08-22 23:33:26 -04:00
Yong Zhao f1c0bc8e35 kfdtest: Query asic name directly from topology node
This saves us from maintaining device ID to Asic mapping in the scripts.

Moreover, stop using abbrevation asic names to avoid confusion.

Change-Id: I7ce583b26b09b627c142aae41932483b28c545d8
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-21 18:49:01 -04:00
Felix Kuehling 626957a263 libhsakmt: Enable HSA_USERPTR_FOR_PAGED_MEM by default
By using user-allocated pages instead of kernel-allocated pages
from TTM, we're not subject to TTM's self imposed limits on kernel
memory usage. This also paves the way for for more wide-spread use
of HMM on upstream kernels.

Change-Id: Iac82964c98a441e29b7f1986d1be1bb5ccb1e569
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-08-20 13:54:04 -04:00
Philip Yang a11cb2a633 libhsakmt: child process destroy vm objects in all apertures
child process clone vm objects from svm->apertures if parent process
doesn't free memory before fork. fmm_clear_all_mem suppose to clear the
apertures in forked child process but this only works if gpu_vm is not
NULL. parent process call hsaKmtCloseKFD reset gpu_vm to NULL and then
fork, then child process will not clear svm->apertures.

As a result, the child process will allocate vm object with same address
and add to aperture, there are duplicate vm objects with same address
in aperture. Then mapping to GPU will find the wrong vm object and
create incorrect GPU mapping cause rocrtst IPC test VM fault. The issue
happened with HSA_USERPTR_FOR_PAGED_MEM=1.

The fix is to clear vm objects in all apertures in clear_after_fork.

Change-Id: I92e42a967075a634a3f475b915c8242d82077ecb
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-08-20 13:31:37 -04:00
Philip Yang 7fc6a9f7c2 Revert "hsaKmtCloseKFD destroy objects in all apertures"
This reverts commit 632ad3a749.

This change causes KFDTest failed on gfx803. The first hsaKmtCreateEvent
call allocate system memory for events_page because global variable
events_page is NULL. And this events page vm address should not be freed
until the process exit.

The change to destrory objects in hsaKmtCloseKFD removes events page. As
a result, KFDTest call hsaKmtOpenKFD again and then allocate memory will
get same events_page vm address on gfx803, and map this vm failed because
the vm conflict with events_page mapping.

KFDTest passed on VG10, gfx906 because allocate memory get different vm
address. hsaKmtCreateEvent still works fine as the driver keeps the
events page mapping of the process.

We should only destroy objects in fork cloned child process regardless
if gpu_vm is NULL or not.

Change-Id: I174ef65321cbd6074c855c2021318fe961c8c72c
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-08-20 10:52:14 -04:00
Yong Zhao 61069a41d3 kfdtest: Update gfx908 test blacklist
Change-Id: Ia83789fca28dc85fe7af4075382dfecbf8972d05
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-16 19:32:10 -04:00
Amber Lin 1fddfd316a libhsakmt: reduce /proc/cpuinfo opens
/proc/cpuinfo are opened, read, and closed multiple times. Once for vendor
name and multiple times for model name -- each node opens once. For example
in a 2 CPUs + 4 GPUs system, it'll be opened 7 times. This patch reads it
one time and stores it in a cpuinfo buffer. This cpuinfo buffer is freed
when the snapshot is done.

Also replace returns with gotos inside the snapshot to avoid possible
memory leak.

Change-Id: Iaf26a6c7e7323a8651d137c3706179449b9e3c80
Signed-off-by: Amber Lin <Amber.Lin@amd.com>
2019-08-15 12:37:26 -04:00
Jonathan Kim c04ebb56b9 kfdtest: add query debug pending events test cases
adding test cases to query debugger pending events

Change-Id: I089754c508e476ce7b19e1cbd84235e4474b30c4
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Kent Russell <Kent.Russell@amd.com>
2019-08-13 10:21:26 -04:00
Eric Huang cdc10991a9 kfdtest: avoid TTM eviction in KFDMemoryTest.BigBufferStressTest
Reserve half of dma32 zone for non-NUMA system.



Change-Id: Id7aea7b6ff6cc1cc7983ecd95f8078b7f1be630c
Signed-off-by: Eric Huang <JinhuiEric.Huang@amd.com>
2019-08-07 16:35:29 -04:00
Yong Zhao 3e4c42ef13 kfdtest: Improve the printing message for CuMasking tests
Decimal is better than hex in this case.

Change-Id: Ic15a9373e99160880b98d3dcd6827d551c87b77a
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-07 13:57:36 -04:00
Jonathan Kim 836dfd0752 libhsakmt: update dbg enable trap and add query debug events
Add data out for enable trap to return poll fd to user space.
Add query debug events interface.

Change-Id: Ia4afde1cf167e6aa61d502380a8b329ee89d5f44
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
2019-08-07 10:04:33 -04:00
Philip Yang 632ad3a749 hsaKmtCloseKFD destroy objects in all apertures
Otherwise the parent call hsaKmtCloseKFD and then fork child process,
child process will duplicate the vm_objects from the parent.

Change-Id: Ia6ffc51cbae983b6a7cdc58ccf3b11ebe4087d97
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2019-08-07 09:34:06 -04:00
Oak Zeng f40f166e20 Remove NodeId parameter from hsaKmtAllocQueueGWS
The NodeId parameter is redundant and can be retrieved
from QueueId parameter.

Change-Id: I12853849b868b304bd27633fa7653ba644d69026
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
2019-08-06 20:20:30 -04:00
shaoyunl e65685df19 KFDTest: simply P2PBandwidthTest case for specified source/destination
Only run the  P2P test over the specified source and destination nodes if user already specify them

Change-Id: Ia3c0195cead7f46e3e28507f3255d8c59a287ab8
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
2019-08-06 18:57:33 -04:00
shaoyunl 65ab296840 KFDTest: Set CS_W32_EN bit for wave32 workloads for GFX10
On GFX10, the wave size is determined by the COMPUTE_DISPATCH_INITIATOR value passed to
DISPATCH_DIRECT.CS_W32_EN, default 0 value was giving 64 lane waves

Change-Id: Ie8c407a24bd2825757ec481be62247b35047e5ca
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
2019-08-06 18:57:14 -04:00
Yong Zhao d954db828d kfdtest: Add gfx908 test cases
Change-Id: I427bb8381ea0690d2b0ae496acd4902fba0d18b4
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-02 11:05:04 -04:00
Yong Zhao 5ae5854302 kfdtest: Improve FlatScratchAccess by not hardcoding the value
We should use the SE number reflected by NumShaderBanks of the node
rather than hardcoding it.

Change-Id: I945fb001f81ce506249cf485a7ce25aee8219bc7
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-01 23:10:28 -04:00
Yong Zhao 23db2c658d libhsakmt: Add gfx908 support
Change-Id: Icced5ca4c68eb6cc3978e0d8e836d0ccfc8c980d
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2019-08-01 23:10:28 -04:00
Konstantin Zhuravlyov 53e4eca485 Allow ccache enabled builds if -DROCM_CCACHE_BUILD=ON
Change-Id: Ia80965feb6e4ff22d466f1ff3142fb2ef303f99c
2019-07-31 16:39:27 -04:00
Felix Kuehling 4d7b0990e4 libhsakmt: Sanity check node_id for NUMA binding
Ignore requests to bind to invalid NUMA nodes. This affects only
legacy applications (such as KFDTest) that allocate system memory
as paged memory with a GPU node ID.

Change-Id: I81e514af6d0c1ab2ed5229adeeca1fa0ab2a0685
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2019-07-31 11:29:52 -04:00
Cole Nelson 20cd954fe8 KFDTest: restore KFDMemoryTest.BigBufferStressTest on gfx900
Addressed by:
4066dcd kfdtest: increase BigBufStressTest timeout and avoid VM fault
36776e9 kfdtest: avoid BigBufStressTest run on NUMA node 0





Change-Id: If21c6e42b4cf6aada1f74e77f0d8d1a2fdebcdb8
Signed-off-by: Cole Nelson <cole.nelson@amd.com>
2019-07-30 12:05:53 -04:00
shaoyunl 78e754ca5b KFDTest: Make shader compatiable for gfx9 and gfx10
Remove the CHIP name from the shader ISA and add wave_size(32) to make the same
shader can be  used for both  GFX9 and GFX10

Change-Id: I16ea72f87980c3d9c11298e20c06a0a073fe9a28
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
2019-07-30 10:56:19 -04:00
Philip Cox b6f6d9da1c Enable KFDGraphicsInterop.RegisterForeignDeviceMem
KFDGraphicsInterop.RegisterForeignDeviceMem looks like it is running
now. Re-enable it for kfdtest for all platforms.

Change-Id: I6f6ee9cd11da793c5d525d8676bfc6d5bd8007bb
Signed-off-by: Philip Cox <Philip.Cox@amd.com>
2019-07-25 14:18:03 -04:00
shaoyunl c0663be7e8 KFDTest: Enable KFDEvictTest.QueueTest for gfx1010
v_add_u32 was removed from gfx10, use carry-out explicit instruction
v_add_co_u32 instead on both gfx9 and gfx10

Change-Id: I1fcd5956844457a676757ad13bdce7f5304bb34b
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
2019-07-25 10:56:17 -04:00