Commit-Graf

84 Incheckningar

Upphovsman SHA1 Meddelande Datum
Philip Yang b0558f264c kfdtest: Update KFDSVMEvictTest.QueueTest for CPX mode
Current test has 4 processes, each process allocate and access 512
buffers, this requires 2048 waves to access 2048 buffers at same time to
finish the test. For CPX compute partition mode, each compute node has
less waves and cause random test failure. Change test to 2 processes to
use 1024 waves to access 1024 buffers with the increased buffer size.

Add waves_num check to avoid the test failure on new ASICs or simulator,
skip test if the available waves is less than 1024.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Change-Id: I64b5f9172b62cf38f62fbb0b48a801b8a11401c0


[ROCm/ROCR-Runtime commit: e6d4a32c42]
2024-10-24 12:57:30 -04:00
David Yat Sin 2e6a37f111 kfdtest: Inherit CXX flags
Change-Id: I2e902ec3e6fd582c53a6d95cd49fe2b18f56b8ca


[ROCm/ROCR-Runtime commit: e1865f7b16]
2024-10-17 14:17:08 -04:00
David Yat Sin 5a8092bccf Revert "hsakmt: Only set exec flag when requested"
This reverts commit cfb1ab45ac.

Reason for revert: 
This is currently breaking some tools. Will put it back as soon as tools update their code.

Change-Id: I05c82d443f3a274a618d05e6dc5a87943f5dc7a4


[ROCm/ROCR-Runtime commit: 80da7d5ee4]
2024-10-16 20:31:27 -04:00
Kent Russell 9f4a01e8a9 kfdtest: Fix in-tree scriptless build
If you build thunk following the instructions in the thunk's README,
there is no /lib folder in the build folder. Adjust the include path,
and clean up the docs to reflect that. The header include is already
defined in the CMake file as ../../include, so we don't use
LIBHSAKMT_PATH for that linking, just the lib location

Change-Id: I73435d59adb9d01f527a28b1935086260e9d3d70
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: ccd80d19ba]
2024-10-08 14:42:33 -04:00
Shweta Khatri 6506a664e7 hsakmt: pmc_table.c: Fix Coverity reported warnings
Eliminate out-of-bounds access in get_block_properties

Change-Id: I3abee1e36fafdda053d4bc4a611698d676b01d5c


[ROCm/ROCR-Runtime commit: 8bc4efc8ca]
2024-10-07 14:15:26 -04:00
Shweta Khatri f2bd877365 hsakmt: debug.c: Fix Coverity reported warnings
Fix potential  memory leak reported by Coverity warnings

Change-Id: Iacbaa99be3f4fe7fae5fb6a10bd41dfc34b96059


[ROCm/ROCR-Runtime commit: 52e7fd1480]
2024-10-07 14:14:26 -04:00
Shweta Khatri 42043a59ea hsakmt: fmm.c: Fix Coverity reported warnings
Fixed multiple issues related to memory management, atomicity,
and error handling across various functions: handle null checks,
use-after-free, unchecked returns, and memory leaks.

Change-Id: Ia7c76320cc20e24001052fbba2dd0600bd412140


[ROCm/ROCR-Runtime commit: c9454794b6]
2024-10-07 13:54:03 -04:00
Jonathan Kim 43ebf5b524 hsakmt: Enable graphics handle registration with a virtual address
Currently registering graphics memory without specifying a target
node will return a memory handle that's not a virtual address.

As a result, ROCr is forced to register with a target node for
IPC usage.

Mapping memory without specifying a target node afterwards will
result in mapping to the target node that was imported because the
previous import call flags this node targeting action to future mapping.

For ROCr IPC usage, ROCr wants to map to all GPU nodes if the target node
is not specified.

Allow the caller to register graphics handles that returns a virtual
address without having to specify the target node so that the caller
can make a subsequent map call to all GPUs.

Change-Id: I5a935092b885cc3568e4f3a5dd951c7ec6c84fca


[ROCm/ROCR-Runtime commit: 03463ed2c0]
2024-10-03 14:06:31 -04:00
Shweta Khatri b4ebbe7448 hsakmt: spm.c: Fix Coverity reported warnings
Fix unused ret value and initialize gpu_id

Change-Id: Ib3acc7db4bbab519318d0970786a5dc641dcc9eb


[ROCm/ROCR-Runtime commit: 9f43c9fd51]
2024-09-30 19:46:51 -04:00
Mukul Joshi e1ffd97abd kfdtest: Update KFDPerformanceTest.P2PBandWidthTest for CPX mode
Currently, KFDPerformanceTest.P2PBandWidthTest cannot work if there are
more than 16 KFD nodes in the system. This limit was put in to match the
number of SDMA queues supported on a single node.
This patch updates the test to make it run on systems with more than
16 KFD nodes.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Change-Id: I561d0cdef664cae84fb9c13a801052e2001256e5


[ROCm/ROCR-Runtime commit: b81e45f03c]
2024-09-30 11:28:33 -04:00
Samuel Zhang 0c81e6a391 SWDEV-484614 - KFDSVMRangeTest.HMMProfilingEvent/1 random fail in VM
In VM with 6vcpu, cpu schedule of
queue_delayed_work(system_freezable_wq) is lower than BM.
HSA_SMI_EVENT_QUEUE_RESTORE event from case HMMProfilingEvent/0 got
delayed execution and caused HMMProfilingEvent/1 fail.

The fix is only listen to HSA_SMI_EVENT_MIGRATE_START event and ignore
all other events.

Change-Id: I534e49b030bd4c534bc7a63eb431f4907659c8cd


[ROCm/ROCR-Runtime commit: 5a1b6bf14d]
2024-09-26 13:37:08 +08:00
Jonathan Kim 4cd7f3b675 hsakmt: Update hsa capabilities with precise ALU ops
Update the HSA capabilities field with precise ALU ops bit support
for GPU debugging.

Change-Id: I796f2c2e0559577828aba510c401ed5187e10179


[ROCm/ROCR-Runtime commit: 027af8dacd]
2024-09-24 13:45:04 -04:00
Jonathan Kim a5954a2442 hsakmt: Update thunk doc comments for debug firmware support caps
Update commentary on HWS scheduler support bit for GPU debugging in
the HSA capabilities node properties field.

Change-Id: I59c519d74a528d5ecf5817ef94e75091314bd844


[ROCm/ROCR-Runtime commit: a926a070ee]
2024-09-23 16:34:31 -04:00
Shweta Khatri fb7b04e06e hsakmt: queues.c: Fix Coverity reported warnings
Move variable declarations inline and add NULL checks to prevent errors

Change-Id: Ia5bf5e245bcc0f756a15bc799b55c5e2a8459f89


[ROCm/ROCR-Runtime commit: 681610937a]
2024-09-23 15:07:28 -04:00
Shweta Khatri 5dff20b660 hsakmt: events.c: Fix Coverity reported warnings
Fix data race by protecting events_page access with mutex in event create
Fix potential NULL dereference in hsaKmtWaitOnMultipleEvents_Ext
Fix unchecked return value in hsaKmtCreateEvent function

Change-Id: I434bef43666e5205a8b061259569c1d99a952752


[ROCm/ROCR-Runtime commit: 857200e28c]
2024-09-23 11:35:02 -04:00
Shweta Khatri b4db09e269 hsakmt: hsakmttypes.h: Fix Coverity reported warnings
Eliminated declared but not referenced variables to fix warnings

Change-Id: I80032a699fb59ce4635c5001f669d009ba60e588


[ROCm/ROCR-Runtime commit: 303c02690d]
2024-09-23 11:34:44 -04:00
Shweta Khatri fa0978e19a hsakmt: topology.c: Fix Coverity reported warnings
Refactor fscanf_str to use fgets for safer string handling, remove unused code

Change-Id: Ibf4b4b485f99bf2fabfe48e9609ca99111feaf1e


[ROCm/ROCR-Runtime commit: 659fa04d8c]
2024-09-23 11:34:28 -04:00
Kent Russell 4901f1a528 hsakmt: Undo HSAKMT prefix for PAGE_SHIFT
We had skipped doing it for PAGE_SIZE, but it should be left as the
regular PAGE_SHIFT name, especially for users who are using different
headers. We want PAGE_SHIFT and PAGE_SIZE to be consistent with one
another, so set them both explicitly to the same value if either
of them is undefined

Change-Id: I121d81c48409dd77351b59a192d824e2419a2410
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: daad183bf8]
2024-09-20 11:04:34 -04:00
Shweta Khatri 848340186f hsakmt: openclose.c: Fix Coverity reported warnings
Add check before close to prevent closing invalid file descriptors

Change-Id: Ie1d50e0d55159512a14a70c1e4be058218aae668


[ROCm/ROCR-Runtime commit: ff6e1b44bf]
2024-09-19 19:44:53 +00:00
Kent Russell 7e130369db hsakmt: Fix BUILD_SHARED_LIBS usage
If BUILD_SHARED_LIBS doesn't get set at all, other projects importing
hsakmt may have an inconsistent state regarding SHARED vs STATIC.
Instead of setting the option and setting it as an option(), just detect
the variable and use it

Change-Id: I9d5a5fc6049ca5351f5e7c63d38ee9bfcb89bdad
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 2a9572dda0]
2024-09-19 19:44:53 +00:00
Kent Russell 0dafd65205 hsakmt: Remove unused functions
The fmm_node_[added|removed] functions were added in the initial FMM
support, but weren't used. Remove them now since no one's referencing
them

Change-Id: I1e46e57294a72012227b38f46c7099de0b9263be
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 3b61f75f49]
2024-09-19 19:44:53 +00:00
David Yat Sin 75e07cc34d hsakmt: Add debug prints to trace mem allocations
Add extra debug prints to trace memory alloc and register

Change-Id: I03d8d7d415565916a8336db6e7063bb7d4cb9102


[ROCm/ROCR-Runtime commit: 0f241d4061]
2024-09-19 19:44:53 +00:00
Ramesh Errabolu 72dc577172 Do not check default value of SVM attribute Granularity
Change-Id: I3cf97fc551259c873351cfd22fc83e8615cc3e56


[ROCm/ROCR-Runtime commit: 71fa3fa19b]
2024-09-19 19:44:53 +00:00
Ranjith Ramakrishnan 2e97c0d3bd Remove license file from hsa-rocr-devel package
License file is already there in hsa-rocr package .Devel package do not need the same

Change-Id: I08cceeb169d0c061078cd495342f78c089087f0d


[ROCm/ROCR-Runtime commit: d60f56ab32]
2024-09-19 19:44:53 +00:00
Chris Freehill 297ccd2244 hsakmt: Update amdp2ptest.c license to MIT
Change-Id: I1eb814dbb4b420840d9877fc6a4806708754ac69


[ROCm/ROCR-Runtime commit: f8d63e2fb4]
2024-09-19 19:44:53 +00:00
Kent Russell 9d797771b5 libhsakmt: Prefix global symbols with hsakmt
To support fully-static library ROCm builds, ensure that all global
symbols are prefixed with something meaningful to avoid collisions with
other libraries

A script was made using" objdump -C -t" to get a list of symbols,
then checking if the global symbols have a meaningful prefix (for thunk:
hsakmt or kmt in various cases)

Change-Id: Ifd353f64a3344eb60d1f6c4e041aa20967b38a59
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 3da42a0847]
2024-09-06 09:56:07 -04:00
David Yat Sin 9cdd382185 kfdtest: Fix ISA buffers not executable
Fix for some places where the ISA buffers are not declared as
executable. Previous code in Thunk was blindly setting exec bit on all
memory allocations so this issue was masked.

Change-Id: Ic7a1169c69fb85ff9e8ea7bcc49a1845b37c08ff


[ROCm/ROCR-Runtime commit: fe8d8c15f1]
2024-09-05 16:57:34 -04:00
Kent Russell 418b4d2006 kfdtest: Check for NULL at MCABackend creation
The function can return NULL if it fails to create the backend, so check
for NULL before using it.

Change-Id: I4d6501bffd6dd0fc0d0f2224720f7d6dca1646f3
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 545467be04]
2024-09-05 12:07:11 -04:00
Chris Freehill b56dd0ef3b hsakmt: Fix ROCr static lib build in new layout
Change-Id: Idc71524924b96a44d63be9b1d0fccbe0e328d96e


[ROCm/ROCR-Runtime commit: 7e13b9e62f]
2024-09-05 10:26:06 -04:00
Kent Russell 8b98df2d47 hsakmt: Free alloc'd memory
trace is calloc'd but never freed. Free it.

Change-Id: I5795cbe5738f25a9621d24be86abb35c263fa8b7
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 4dc9d49aa6]
2024-09-05 10:20:09 -04:00
Shane Xiao 7ec6819ff5 Revert "gfx11 is able to perform atomic ops even PCI reports no atomic support."
This reverts commit 7daedd5eef.
For APU, the PCIe atomic is supported by default. However, the PCIe
atomic feature needs to checked for dGPU. The kfd driver has already
set PCIe atomic support for APUs, so this patch can be reverted.

Change-Id: I131d5b8e095c1104e1695e7cf8b1ed178bccddde
Signed-off-by: Shane Xiao <shane.xiao@amd.com>


[ROCm/ROCR-Runtime commit: 821f6e58f9]
2024-09-05 01:44:16 -04:00
Jeremy Newton 284a1f1dc4 kfdtest: Drop sp3 licensing comments
This is obsolete and can be dropped.

Change-Id: I4ed7d22567043f9cca39879a82e5ea945c27efc1
Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>


[ROCm/ROCR-Runtime commit: c574c81835]
2024-09-04 11:20:38 -04:00
Xuanteng Huang b1b4d4af59 hsakmt: fix spelling error
This was pulled in from:
https://github.com/ROCm/ROCT-Thunk-Interface/pull/107

Change-Id: Ic30e4552a94a212a9cd138f9311b1c85b0c13867


[ROCm/ROCR-Runtime commit: 7a52a45824]
2024-09-04 10:46:39 -04:00
Tom Rix a11a34468d kfdtest: Improve finding rocm-smi
On Fedora, rocm-smi is a standard package and is installed to /usr/bin
So when run_kfdtest.sh is run this error is produced

find: ‘/opt/rocm*’: No such file or directory

First redirect stderr to dev/null on the original search.
Then fall back to either looking for rocm-smi in BIN_DIR or
look for it in the PATH.

Change-Id: I389ed0b9a4a4507263c9eb19894b25326c9a4222
Signed-off-by: Tom Rix <Tom.Rix@amd.com>
Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>


[ROCm/ROCR-Runtime commit: b9c6144f23]
2024-09-04 09:20:32 -04:00
Joseph Greathouse cfb1ab45ac hsakmt: Only set exec flag when requested
Previous code would blindly set executable bit on all allocations.

Change-Id: Id1154f08f6ba21c633905fd46b06053994d6f3cc


[ROCm/ROCR-Runtime commit: 75143555fa]
2024-09-03 15:13:56 -04:00
Jeremy Newton 77b61a6c79 Fix permissions on kfdtest
Using "PROGRAMS" and "FILES" without specifying permissions will
automatically select the right permissions.

PROGRAMS is used for executables, FILES is used for data files

Change-Id: I0fb6eff257a8f936848bd648cf877da6dc0b6906


[ROCm/ROCR-Runtime commit: 8fd1b14a42]
2024-09-03 14:11:01 -04:00
Jonathan Kim 0c5509e7c3 libhsakmt: Fix improper type range check in legacy queue creation
Enum type for compute AQL is defined as larger then targeted SDMAs
enum types.  We should only deny legacy calls for SDMA queues that
require targeted engines.

Change-Id: I6386a8700b3b18af825b6f0d2be27052cc8de0f5


[ROCm/ROCR-Runtime commit: ae99effb29]
2024-08-28 13:55:41 -04:00
Lancelot SIX 38e448df2d libhsakmt: Check for KFD 1.13 for debug ioctl interface
Core dump support relies on debugger related KFD ioctl which have been
introduced in version 1.13 of the interface.  However, the code checks
for KFD_IOCTL_MINOR_VERSION (currently 17), making it impossible to
produce core dumps when using some drivers that should support it.

Update the CHECK_KFD_MINOR_VERSION calls in the debugger related ioctl
wrappers and look for KFD 1.13 or above.

Change-Id: I10a7fd03bf8f678b6318d7c25d6a7ded804dac67


[ROCm/ROCR-Runtime commit: d5acab2b39]
2024-08-21 23:45:25 +01:00
Jonathan Kim 2412b27726 libhsakmt: Extend thunk queue creation with recommended sdma engines
Extend the current Thunk implementation of queue creation to target
specific SDMA engine IDs.

Also expose the new recommend SDMA engines per IO link from the KFD
sysfs.

Change-Id: I51f9a0d83c0f1fc4d5dc837f879a7ae332e7d7e9


[ROCm/ROCR-Runtime commit: 2f588a2406]
2024-08-20 11:13:57 -04:00
Yifan Zhang 45979fdfc7 libhsakmt: add OverrideEngineId property
When HSA_OVERRIDE_GFX_VERSION is used, save the overrided GFX
version to OverrideEngineId instead of original EngineId. There
are places where real GFX properties still needed, e.g. CWSR size
calculation.

Change-Id: I9d9149bae465b7cfe55604fc19e7ca34e48b7b1c
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>


[ROCm/ROCR-Runtime commit: 3f1f68c8cb]
2024-08-20 09:10:52 -04:00
David Yat Sin db39e99e5a libhsakmt: Add two symbols to global symbols
For users still using non-static hsakmt

Change-Id: I12b1c25f0d952ed9178529cadc518c57c1aeb06d


[ROCm/ROCR-Runtime commit: 4ffa325c08]
2024-08-19 14:56:00 -04:00
Chris Freehill 3bdfe00bb7 Change "devel" to "dev" for runtime-rocr
Also, don't call rpm command if distro doesn't support it.

Change-Id: I7f39f9c1f39c5408967d66e2db1f471847c5e668


[ROCm/ROCR-Runtime commit: 6fda123836]
2024-07-19 22:58:07 -05:00
Alex Sierra 006d1d4dc7 src/fmm.c: fallback to old userptr reg if SVM fails
Fallback to old userptr registration in case SVM method fails.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Change-Id: I70c3ec74a8b4f762713e6a0619453642f3fca8e5
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: 626eb4bfaf]
2024-07-18 10:20:05 -05:00
Adam Niederer ffafd46406 Allow overriding gfx version per-node
This lets you run two unsupported-but-really-supported cards of different architecture together in the same program. Works great w/ llama.cpp on my 7900XT + 6600.

Example usage (device 0 is RDNA3, device 1 is RDNA2):

HSA_OVERRIDE_GFX_VERSION_1="11.0.0" HSA_OVERRIDE_GFX_VERSION_2="10.3.0" ollama serve

Change-Id: Ic63ef462f698dee722d360f7fc3ef72789c277b7
Signed-off-by: AdamNiederer
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: 84567b6416]
2024-07-18 10:20:05 -05:00
Tim Huang 516199b400 kfdtest: add blacklist for gfx1152
Change-Id: I74c957539c138160ed379aea7e1fa253d7648175
Signed-off-by: Tim Huang <tim.huang@amd.com>
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: 06242b70e7]
2024-07-18 10:20:05 -05:00
David Belanger b2d09b7e8d kfdtest: Fix DeviceHdpFlush on GFX12
Fix register COMPUTE_PGM_RSRC2 in Dispatch code.
Bit 6 (called TRAP_PRESENT on pre-GFX12) should not be set on GFX12
as it has a different meaning (DYNAMIC_VGPR).

Minor instructions changes for CopyOnSignalIsa and WriteAndSignalIsa
shaders.

Change-Id: Ib4e75e3c92f220210bc45778738d81b91efb9d5e
Signed-off-by: David Belanger <david.belanger@amd.com>
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: 611911020c]
2024-07-18 10:20:05 -05:00
Kent Russell 856c8d3e10 kfdtest: Add required LLVM header
A function call was refactored out of CommandLine.h, so add the header
to include it

Change-Id: If5594e3abc2fdfdd59f108c4379802cedab127ee
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: bd2d9770f7]
2024-07-18 10:20:05 -05:00
Philip Yang b6e18ceeae kfdtest: Skip ContiguousVRAMAllocation if no enough VRAM
RDMATest.ContiguousVRAMAllocation test uses 4GB buffer, skip the test if
total VRAM size is less than 5GB, considering page table and other
reserved VRAM usage.

Change-Id: I0342417501cdd3477c2bf1b2f7d1e6bef61d1871
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Chris Freehill <cfreehil@amd.com>


[ROCm/ROCR-Runtime commit: 42df8b2b34]
2024-07-18 10:20:05 -05:00
Chris Freehill 405b60af73 Use static drm and drm_amdgpu for static builds
This commit was ported from old repo.
Original author: Ranjith Ramakrishnan <Ranjith.Ramakrishnan@amd.com>

For static builds use drm and drm_amdgpu static libraries for linking.

Created a separate cmake target file and static library for static use case

The config file will include the respective target file based on
BUILD_SHARED_LIBS.

Default target file will be the one where drm and libdrm_amdgpu shaed libraries
are linked.

Applications using statically linked cmake targets of hsakmt should install the
required static libraries before building.

Change-Id: Idf4e1a2b5f18b344f5a9927803756d50c2b33702


[ROCm/ROCR-Runtime commit: 9e8477e1c9]
2024-07-18 10:19:49 -05:00
Chris Freehill 76d33c555f Changes to build ROCr & thunk (optionally tests) in rocr-runtime repo
Create a new top-level CMakeLists.txt file to control building thunk
and ROCr. kfdtest and rocrtest are built separately.

Most of the cmake code that existed for thunk, ROCr, rocrtst and kfdtest
still reside in their respective CMakeLists.txt files, except the
CPack packaging directives which have been moved to the top-level
CMakeLists.txt.

Change-Id: I1a537359029504af8b1abb324bc6f0d75d98471e


[ROCm/ROCR-Runtime commit: 662f6817d7]
2024-06-24 14:26:21 -05:00