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

380 Коммитов

Автор SHA1 Сообщение Дата
Kent Russell dffac0a97e kfdtest: Style cleanup
Clean up the KFDTest style via CPPLint. Some warnings remain regarding
volatile variables being cast to void*. This is the command used:
cpplint.py --linelength=120
--filter=-readability/multiline_string,-readability/todo,-build/include,-runtime/references

multiline_string is due to using ISA code
todo is to avoid errors that we don't have TODO(username) instead of TODO
include is about including the folder in the header includes
references is regarding non-const references '&' being const or using
pointers. That can be addressed later

Change-Id: I3c6622da0a13dd33ab29b2bfff48be25e763b750
2018-08-14 08:17:57 -04:00
xinhui pan 3f7b6356fd kfdtest: fix a memory leak issue in MMapLarge test
When mapMemoryToGpu fails, we need unregister it with user address as
the gpu address is not available.

Change-Id: I4418eeaa7aa37008f5bffa144e2c2171f0d238fd
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-08-10 05:26:06 -04:00
xinhui pan eb5539fb10 thunk: fix a memory leak
Hit queue create failure when do kfdtest with --gtest_repet=-1

fix: 4bb90d04("Remove the use of IS_DGPU()")

Change-Id: I04fa73f90cef13a5517dbaceb89c41dc0f821a79
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-08-10 15:51:32 +08:00
Yong Zhao 110e754f64 Differentiate gfx700 and improve the logic by introducing is_gfx700()
Because gfx700 has local memory but other APUs don't, we should reflect
that in the code. Meanwhile, fix a bug that on gfx902 svm aperture is not
added when calling hsaKmtGetNodeMemoryProperties().

Change-Id: Id840f2db0b14fda9ee713b219a9474c15f8a9771
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2018-08-09 21:39:37 -04:00
xinhui pan 8fbf4a26ec thunk: fix a vm area release issue
On some asics, like tonga, the memory alignment size is as big as 0x8000.

fmm_allocate* alloc vm area with size passed in which is not aligned mostly.
But __fmm_release free vm area with vm_object_t->size which is aligned.

That might cause aperture_release_area fail to free the vm area as the
size might be bigger than zone itself or it just free another vm area
nearby unexpected.

This patch somehow will alloc more space than it needed on tonga.
gfx900+ is not affected.

Change-Id: I5a88c92b08c4e6f6bc05881798f769b55d6debe9
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-08-09 06:08:15 -04:00
Yong Zhao fe04dd6890 Calculate and store the first gpu mem during initializaiton
Previously we used the first dgpu mem, but after careful examination, we
found it only needs to be a GPU, so we modify the code to reflect that as
well.

Change-Id: I069d9b8e247aed55c1f885b79f743ea8e03ddf93
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2018-08-08 13:54:09 -04:00
xinhui pan 9d6d0911e4 kfdtest: make p2ptest go through all gpus
Implement sDMA copy packet broadcast.

Each time sDMA will copy its local vram to sysbuf and next GPU's vram.
That will verify where the p2p link is broken.
Currently we just test push of p2p.

test result on 2 cpus, 4 gpus, numa enabled system.
[ RUN      ] KFDQMTest.P2PTest
[          ] Test 2 -> 3
[          ] PASS 2 -> 3
[          ] Test 3 -> 4
[          ] PASS 3 -> 4
[          ] Test 4 -> 5
[          ] PASS 4 -> 5
[          ] Test 5 -> 0
[          ] PASS 5 -> 0
[       OK ] KFDQMTest.P2PTest (190 ms)

Change-Id: Ie6fb2604109e39465b8a873b3bb42abc6259825a
2018-08-07 21:13:37 -04:00
Yong Zhao 4bb90d048c Remove the use of IS_DGPU()
The information can be obtained directly from node id. Also improve the
whole logic for future compatibility.

Change-Id: I130733be4e7930d5953d5e81409905e60c2ec35e
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2018-08-07 18:07:04 -04:00
Felix Kuehling c21927f425 libhsakmt: Fix problems init_svm_apertures
Unset ret_addr when unmapping the address space reservation. Otherwise
it may try to unmap it again later.

Remember the actual map_size and use it instead of len outside the
reservation loops.

Change-Id: I1a6b3fecfb59e22a713e5ed49c3ed37914cb6fb5
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-08-03 22:09:52 -04:00
Felix Kuehling dd6f34b7f5 libhsakmt: Fix pkg-config file paths
Both the include and libpath were incorrect after recent build
system changes. Use the proper GNUInstallDirs definitions in
libhsakmt.pc.in to write the proper locations.

This is needed for end users building KFDTest, which depends on
correct pkg-config information.

Change-Id: Ia45f36f054c2a607a77e7ecbcbd9eb7edd067348
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-08-03 20:17:09 -04:00
Felix Kuehling 5c742f3e5e kfdtest: Blacklist Fragmentation test on all chips
This test has been intermittently failing for various reasons and
was already disabled on all chips except Ellesmere. It stresses
memory management in unusual ways by having lots of memory allocated
but +# not mapped, which is not relevant to compute applications over
ROCr.



Change-Id: I6b791ca7e2e0fcfe93fc720063b4b56acfded751
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-08-03 20:14:46 -04:00
Eric Huang 3167e3b964 KFDEvictTest: change buffer size and add GFX vram allocation
This is to coordinate kfd kernel vram limit change, and adding
GFX vram allocation with submission of command nop is to
trigger eviction.



Change-Id: I18615cd13cfde034aae09c188ae3a82babde97b9
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
2018-08-03 15:44:32 -04:00
Eric Huang f8d19104aa Kfdtest: Change and move drm device function into KFDBaseComponentTest
It is for other test to reuse this function.

Change-Id: Ib0dbc1a267a5bbcd8078ab3265677b53531f86f3
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
2018-08-03 15:43:28 -04:00
Yong Zhao 08b6685dd5 Change the confusing type and name in topology
node is used repeatedly and excessively, which caused unnecessary confusion.

Change-Id: I4ae4171887df5e5b85209a5af8a636e6d72e5e82
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
2018-08-03 12:00:17 -04:00
Kent Russell b629dd1888 spec: Only remove ldconf file if uninstalling
$1 is passed in during install/upgrade/uninstall. If this is an
uninstall, remove the ldconf file, otherwise leave it. In yum-based
systems, the uninstall from the old package is executed after the
post-install of the newer package, which will undo the ldconf work from
the newer package.

Change-Id: I1681cb3bc65f0bd802bce5703187ae5f4d3f3530
2018-08-03 07:33:26 -04:00
Yong Zhao f3e7870784 kfdtest: Evaluate whether a node is APU based on spec
This will facilitate the user cases that some APU asics is used as dGPU.

Change-Id: Ib3a79ae31a03e7a618c7785166f56282a7617127
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-08-02 11:36:40 -04:00
xinhui pan 86552aba4b kfdtest: make the output of QueueLatency test more readable
Change-Id: Ib33ac25509b23f2e5869bde126e3f11ef60f017e
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-08-01 10:06:33 +08:00
Yong Zhao 1d43938ac7 kfdtest: Add run utility files for kfdtest
A README.txt file is added to help the opensource community to use kfdtest
effectively.

After building, run_kfdtest.sh in the building output folder can be used
to run the test.

Change-Id: I9612d9d5a63bd4cdc3a328efd9961d3cc92a6ba5
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-07-31 00:02:04 -04:00
Yong Zhao f8472a055c kfdtest: Use libhsakmt to replace all the occurrences of thunk
Thunk is an internal name and we'd better reference it using the library name.

Change-Id: I20042bda546e5249530311d3de30c71d99379033
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-07-31 00:02:04 -04:00
Yong Zhao 6df62c78b8 kfdtest: Add kfdtest source code
The code is a snapshot up to this commit around July 31 2018.

commit b00fadff36a3
Author: xinhui pan <xinhui.pan@amd.com>
Date:   Mon Jul 30 09:53:03 2018 +0800

    kfdtest: skip MMapLarge test on apu

    

Change-Id: I40e9a5a18e5c8f075e5290bb80532f1a3f689058
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-07-31 00:00:34 -04:00
Kent Russell 3719ec2557 RPM: Add /opt/rocm/lib64 to lib path
CentOS+cmake suffix the "lib" folder with 64 when building 64-bit
packages

Fixes: 9434223752: Clean up cmake install and package



Change-Id: If029afd6e198b812116f3d3b3921b5486a1be355
2018-07-25 20:00:44 -04:00
Sean Keely 63f2a0d280 Fix git describe command to retrieve version tags correctly.
Change-Id: I33282e8130d092e2f56b2f5947946d3c0ee22c60
2018-07-10 19:49:00 -05:00
xinhui pan ab9017715f use rbtree instead of vm_objects list
simple test of mapping many system memory to gpu.
before
[ RUN      ] KFDMemoryTest.MMap
[          ] Using ISA for GFXIP 9.0
[          ] successfully register/map 32GB system memory to gpu
[       OK ] KFDMemoryTest.MMap (36932 ms)

after
[ RUN      ] KFDMemoryTest.MMap
[          ] Using ISA for GFXIP 9.0
[          ] successfully register/map 32GB system memory to gpu
[       OK ] KFDMemoryTest.MMap (11441 ms)

So there is 11s VS 36s improvement.

Looks like we can do something similar with vm_area too.

Change-Id: I0349aacdeddec3534016d28176f0fabf632c61fc
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-07-08 22:38:22 -04:00
Felix Kuehling d3228f363e Fix wrong loop termination condition
Compare with gpu_mem_count instead of deprecated NUM_OF_SUPPORTED_GPUS
to prevent overflows in case no dGPUs are present.

Change-Id: I71fcb7503ba4c20bffadbdb04cefc4e4027a7df7
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-07-05 17:04:40 -04:00
Yong Zhao 4839882fc8 Set the write permission according to the flag when allocating host cpu mem
Change-Id: I758c2b5b1799e968fa852646e1494fabb68c782d
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-07-03 20:39:01 -04:00
Slava Grigorev 89e35574e3 Fix 'strncpy' truncating warnings when compiling with gcc 8
Change-Id: Ib145bab9450281da05f70dea34433b83438a756b
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
2018-06-29 17:06:08 -04:00
Yong Zhao 4eaaf9694d Simplify if else logic for hsaKmtAllocMemory()
The new logic is easier to follow.

Change-Id: I69759a45c5dedaefeff831a2367253d3a4486bd3
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-06-29 14:39:52 -04:00
Yong Zhao 5972fac417 Rename two variable names in doorbells structure
There were two doorbells, one embedded in another, which are very confusing.
Change the member variable name to mapping to differentiate them. Also,
rename doorbells_mutex to just mutext for brevity.

Change-Id: Iaa14a1a3ee09449a9089fc1fb39c916fdf32fb44
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-06-28 16:04:35 -04:00
Yong Zhao 77ec699460 Fix a bug that fmm_init_process_apertures() returns incorrect value
If opening drm render device fails (usually when the user is not a member
of video group), fmm_init_process_apertures() still returns success,
resulting in weird segfault in a later stage.

Change-Id: Ifbde4481629988944ad7f384d59753c88e287fa9
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-06-28 16:03:07 -04:00
Felix Kuehling fb551a44af Fix compiler warning on Fedora 28
Avoid warnings of the type
    error: 'strncpy' specified bound 64 equals destination size

With the destination being 0-initialized, subtracting 1 from the
destination buffer size will ensure that the destination will be a
0-terminated string, even when it's truncated.

Change-Id: I7c3a90482065ce4d020db215e3e41348de51a083
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-06-25 14:36:49 -04:00
Felix Kuehling 4e766615d7 Fixup previous commit
Add back missing pthread_mutex_lock.

Handle all error cases in fmm_release.

Change-Id: I8efa561ddadfd769cede5bf86300215ba3fb3dd1
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-06-25 14:24:23 -04:00
xinhui pan 8ee5647814 THUNK: fix deregister memory issues
__fmm_release actually fails to find the object if address is not
pagesize aligned.  And the caller did not notice this as __fmm_release
has no err code return.

So to fix this, move the object lookup in caller, and use vm-object
instead. Also fmm_release will pass up the error code.

Change-Id: Ib8ea1ea5ae844844fd20e8e01f0fdb841d218f2c
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
2018-06-25 14:12:26 -04:00
Felix Kuehling 9434223752 Clean up cmake install and package
* Use GNUInstallDirs
* Install headers in $prefix/include directly, drop symlink
* Install libraries in $prefix/lib directly, drop symlink
* Move LICENSE.md from hsakmt-roct-dev to hsakmt-roct

Change-Id: I43562f15cc03029be53e9ec18c337824d8116659
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-06-20 11:32:53 -04:00
Yong Zhao 7a8566dc03 Improve the return value for hsaKmtOpenKFD()
When KFD is already opened, Opening it again should return
HSAKMT_STATUS_KERNEL_ALREADY_OPENED to align with the specification.

Change-Id: Ib10a2d2c48781600bea7d072557d03ccb1a2bc19
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-06-11 14:08:57 -04:00
Felix Kuehling 0462744965 Add fallback for GPUVM doorbell mapping
Upstream KFD doesn't support mapping doorbells to GPUVM yet. Fall
back to the old method.

Change-Id: I452a6fc59b88329b833844e3914c480c2f13c82d
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-05-31 13:17:27 -04:00
Felix Kuehling 7495e74257 Cosmetic changes to kfd_ioctl.h
Make it more similar with upstream.

Change-Id: I982ccfd4045d96e3c30bc84d38d0e03db8de9b08
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-05-31 13:17:27 -04:00
Felix Kuehling 571e2cf7e4 Update KFD-Thunk ioctl ABI to match upstream
- Clean up and renumber scratch memory ioctl
- Renumber get_tile_config ioctl
- Renumber set_trap_handler ioctl
- Update KFD_IOC_ALLOC_MEM_FLAGS
- Renumber GPUVM memory management ioctls
- Remove unused SEP_PROCESS_DGPU_APERTURE ioctl
- Update memory management ioctls
    Replace device_ids_array_size (in bytes) with n_devices. Fix error
    handling and use n_success to update device_id arrays in objects.

This commit breaks the ABI and requires a corresponding KFD change.

Change-Id: Ibf0af5a5188e817c886eab388d1533130fc18293
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-05-31 13:17:27 -04:00
Shaoyun Liu 93d07cf916 Thunk: Add gfx906 support on thunk
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>

Conflicts:
	src/topology.c

Change-Id: I692d9295a954d4eda08eba301312014f7b3969cb
2018-05-29 15:38:26 -04:00
Yong Zhao ec440fb428 Stop allocating eop buffer for SDMA queues
Change-Id: I9a4eaee05588292a797eb424503dd7b793c1408c
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-05-16 15:30:23 -04:00
Yong Zhao 43f119bcbc Improve the code readablity
The main point is to move update_ctx_save_restore_size() out of if()
condition.

Change-Id: I58a1a4f3edca2d1c510fdd0e31e59b5c41e92a14
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-05-16 14:55:55 -04:00
Felix Kuehling 2915d521a1 Remove redundant dev package build
No need to build the package in the build-dev target. This is taken
care of by package-dev. Removing the redundant packaging command
allows install-dev to work without building a package unnecessarily.

Also moved the rm command into the package-dev target.

Change-Id: I044871be03ebc5673146b44e4291b48b112f4440
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-05-04 14:04:19 -04:00
Oak Zeng dc1bbccc39 Use svm aperture for device memory allocate for gfx902 and after APU
Change-Id: Ib1d822adde30138a016e010bf581220465a087b9
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
2018-05-03 12:03:22 -04:00
Shaoyun Liu aa28484583 Thunk: Add gfx904 support on libthunk
Change-Id: I78bc623f6b86293e2bf9fbe00a646d152faafdc4
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
2018-03-29 18:21:02 -04:00
Felix Kuehling 8ac2150e81 Let KFD use VM from DRM render node
Move opening of DRM render nodes from topology to FMM aperture
initialization. Keep the same FDs open for the life time of the
process to match how KFD uses the VMs in the FDs. Call acquire_vm
ioctl during aperture initialization to let KFD use the VMs from
the render nodes.

Change-Id: Ie07d57788cbe685b1841cccc00820c12894a0356
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-03-20 15:42:45 -04:00
Philip Yang 1bf93d4e89 Export microcode version of sDMA
Change-Id: I86fa5da5e72af13a2e76e6e3be4667a7220923d5
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
2018-03-19 08:38:50 -04:00
Felix Kuehling 19dacdecd3 Update kfd_ioctl.h from kernel
This adds new acquire_vm ioctl.

Change-Id: Ia6794bfd291706cecdb2d06f4902b324b48577df
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-03-09 16:36:52 -05:00
Felix Kuehling 85e1a9bf5e Rework SVM aperture initialization
Query GPUVM aperture limits of all dGPUs to determine SVM aperture
base and limit. This depends on a recent KFD change that reports
the GPUVM apurture limits for dGPUs in the
AMDKFD_IOC_GET_PROCESS_APERTURES_NEW ioctl (drm/amdkfd: Simplify
dGPU SVM aperture handling).

Only initialize SVM aperture once, instead of once per GPU.

Don't call AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE. It's not needed any
more and will not be upstreamed.

Change-Id: Ib3389e8ba18505ba15fc33f45fe8a57e690a565d
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-03-09 16:36:49 -05:00
Felix Kuehling c5cfb7e25b Move dGPU memory aperture initialization
Define dgpu_mem_init before it's used and keep the code close to the
rest of the aperture initialization code.

Change-Id: I14ad11a364524a15affee9186b1298ba7d56d2c9
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
2018-03-09 15:00:12 -05:00
Yong Zhao 15e525af45 Add pkg config support in the hsakmt-roct-dev package
Change-Id: Ida6b3083bfc9405ef9b6b8e426dc7dc51d61a811
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-02-27 11:21:38 -05:00
Yong Zhao 2c426a026a Turn off the verbose building message
Change-Id: If4ebdb6f87fde9c3cc76b16c57e862bfb972ed5e
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
2018-02-26 18:17:13 -05:00