Created
September 19, 2024 15:02
-
-
Save makslevental/1ef2e10e122a481bbb45e1ee9a2026b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2024 The IREE Authors | |
// | |
// Licensed under the Apache License v2.0 with LLVM Exceptions. | |
// See https://llvm.org/LICENSE.txt for license information. | |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
#include <csignal> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <fcntl.h> | |
#include <fstream> | |
#include <sys/ioctl.h> | |
#include <sys/mman.h> | |
#include "amdxdna_accel.h" | |
#define DATA_BUFFER_SIZE (1024 * 4) | |
/* | |
* Interpretation of the beginning of data payload for ERT_CMD_CHAIN in | |
* amdxdna_cmd. The rest of the payload in amdxdna_cmd is cmd BO handles. | |
*/ | |
struct amdxdna_cmd_chain { | |
uint32_t command_count; | |
uint32_t submit_index; | |
uint32_t error_index; | |
uint32_t reserved[3]; | |
uint64_t data[] __counted_by(command_count); | |
}; | |
/* Exec buffer command header format */ | |
struct amdxdna_cmd { | |
union { | |
struct { | |
uint32_t state : 4; | |
uint32_t unused : 6; | |
uint32_t extra_cu_masks : 2; | |
uint32_t count : 11; | |
uint32_t opcode : 5; | |
uint32_t reserved : 4; | |
}; | |
uint32_t header; | |
}; | |
uint32_t data[] __counted_by(count); | |
}; | |
// These packets are variable width but using this as a | |
// maximum size for now | |
#define PACKET_SIZE 64 | |
void gc_bo(int drv_fd, void *buf, size_t size, uint32_t handle) { | |
drm_gem_close close_bo; | |
int bo_free_ret; | |
close_bo = {handle, 0}; | |
bo_free_ret = ioctl(drv_fd, DRM_IOCTL_GEM_CLOSE, &close_bo); | |
if (bo_free_ret != 0) { | |
perror("Failed to free create_cmd_bo_0"); | |
exit(-1); | |
} | |
// munmap(buf, size); | |
} | |
int alloc_heap(int fd, __u32 size, __u32 *handle, void *heap_buf) { | |
int ret; | |
const size_t alignment = 64 * 1024 * 1024; | |
ret = posix_memalign(&heap_buf, alignment, size); | |
if (ret != 0 || heap_buf == NULL) { | |
printf("[ERROR] Failed to allocate heap buffer of size %d\n", size); | |
} | |
amdxdna_drm_create_bo create_bo_params = { | |
.type = AMDXDNA_BO_DEV_HEAP, | |
.size = size, | |
}; | |
ret = ioctl(fd, DRM_IOCTL_AMDXDNA_CREATE_BO, &create_bo_params); | |
if (ret == 0 && handle) { | |
*handle = create_bo_params.handle; | |
} | |
amdxdna_drm_get_bo_info get_bo_info = {.handle = create_bo_params.handle}; | |
ret = ioctl(fd, DRM_IOCTL_AMDXDNA_GET_BO_INFO, &get_bo_info); | |
if (ret != 0) { | |
perror("Failed to get BO info"); | |
return -2; | |
} | |
// Need to free the heap buf but still use the address so we can | |
// ensure alignment | |
free(heap_buf); | |
heap_buf = (void *)mmap(heap_buf, size, PROT_READ | PROT_WRITE, MAP_SHARED, | |
fd, get_bo_info.map_offset); | |
printf("Heap buffer @: %p\n", heap_buf); | |
return ret; | |
} | |
int main(int argc, char **argv) { | |
int drv_fd; | |
int ret; | |
const char drv_path[] = "/dev/accel/accel0"; | |
std::string test_dir( | |
"/home/mlevental/dev_projects/ROCR-Runtime/rocrtst/suites/aie"); | |
std::string inst_path = test_dir + "/add_one_insts.txt"; | |
std::string pdi_path_str = test_dir + "/add_one.pdi"; | |
const char *dpu_inst_path = inst_path.c_str(); | |
const char *pdi_path = pdi_path_str.c_str(); // Add one kernel | |
uint32_t heap_handle; | |
uint32_t major, minor; | |
// open the driver | |
drv_fd = open(drv_path, O_RDWR); | |
if (drv_fd < 0) { | |
printf("Error %i opening %s\n", drv_fd, drv_path); | |
return -1; | |
} | |
printf("%s open\n", drv_path); | |
// reserve some device memory for the heap | |
void *heap_buf = nullptr; | |
if (alloc_heap(drv_fd, 64 * 1024 * 1024, &heap_handle, heap_buf) < 0) { | |
perror("Error allocating device heap"); | |
printf("Closing\n"); | |
close(drv_fd); | |
printf("Done\n"); | |
return -1; | |
} | |
printf("Closing\n"); | |
close(drv_fd); | |
printf("Done\n"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[94167.195003] amdxdna_drm_open: amdxdna 0000:c5:00.1: 22 | |
[94167.205693] amdxdna_rpmops_resume: amdxdna 0000:c5:00.1: 241 | |
[94167.205709] aie2_hw_start: amdxdna 0000:c5:00.1: 381 | |
[94167.265467] aie2_smu_set_dpm_level: amdxdna 0000:c5:00.1: The dpm level is set to 0 | |
[94167.305477] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: 92 | |
[94167.305483] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x tail 0x2d000 | |
[94167.305486] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x head 0x2d004 | |
[94167.305488] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x ringbuf 0x3d000 | |
[94167.305490] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x rsize 0x400 | |
[94167.305492] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i tail 0x2c000 | |
[94167.305493] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i head 0x2c004 | |
[94167.305495] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i ringbuf 0x3c000 | |
[94167.305497] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i rsize 0x400 | |
[94167.305499] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i chann index 0xe | |
[94167.305752] xdna_mailbox_create_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: Mailbox channel created (irq: 132) | |
[94167.305757] aie2_check_protocol_version: amdxdna 0000:c5:00.1: 89 | |
[94167.305760] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.305762] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.305776] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x301 size 4 id 0x1d000000 | |
[94167.305825] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x301 size 12 id 0x1d000000 | |
[94167.305842] resp data: 00000000: 00000000 00000005 00000005 ............ | |
[94167.305857] aie2_check_protocol: amdxdna 0000:c5:00.1: 60 | |
[94167.305860] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.305862] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.305877] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 12 id 0x1d000001 | |
[94167.305909] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 4 id 0x1d000001 | |
[94167.305918] resp data: 00000000: 00000000 .... | |
[94167.305931] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.305933] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.305944] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 4 id 0x1d000002 | |
[94167.305974] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 12 id 0x1d000002 | |
[94167.305993] resp data: 00000000: 00000000 00000001 00000000 ............ | |
[94167.306006] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.306009] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.306019] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 12 id 0x1d000003 | |
[94167.306051] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 4 id 0x1d000003 | |
[94167.306060] resp data: 00000000: 00000000 .... | |
[94167.306072] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.306075] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.306084] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 4 id 0x1d000004 | |
[94167.306114] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 12 id 0x1d000004 | |
[94167.306138] resp data: 00000000: 00000000 00000001 00000000 ............ | |
[94167.306151] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.306153] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.306161] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x103 size 4 id 0x1d000005 | |
[94167.306191] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x103 size 4 id 0x1d000005 | |
[94167.306195] resp data: 00000000: 00000000 .... | |
[94167.306207] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.306209] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.306218] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d000006 | |
[94167.306254] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d000006 | |
[94167.306263] resp data: 00000000: 00000000 .... | |
[94167.306274] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94167.306276] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94167.306285] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x102 size 4 id 0x1d000007 | |
[94167.306362] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x102 size 4 id 0x1d000007 | |
[94167.306372] resp data: 00000000: 00000000 .... | |
[94167.306386] aie2_error_async_events_send: amdxdna 0000:c5:00.1: 275 | |
[94167.306391] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db60000 size 0x2000 | |
[94167.306415] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d000008 | |
[94167.306429] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db62000 size 0x2000 | |
[94167.306435] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d000009 | |
[94167.306439] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db64000 size 0x2000 | |
[94167.306446] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000a | |
[94167.306450] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db66000 size 0x2000 | |
[94167.306455] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000b | |
[94167.306459] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db68000 size 0x2000 | |
[94167.306464] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000c | |
[94167.306467] amdxdna_rpmops_resume: amdxdna 0000:c5:00.1: Runtime resume done ret: 0 | |
[94167.306576] amdxdna_drm_open: amdxdna 0000:c5:00.1: PID 148767 opened | |
[94167.306689] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: 648 | |
[94167.306691] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: 649 | |
[94167.306692] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: BO arg type 2 vaddr 0x0 size 0x4000000 flags 0x0 | |
[94167.306694] amdxdna_drm_create_dev_heap: amdxdna 0000:c5:00.1: 489 | |
[94167.306695] amdxdna_drm_create_dev_heap: amdxdna 0000:c5:00.1: 490 | |
[94167.306744] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: BO hdl 1 type 2 userptr 0xffffffffffffffff xdna_addr 0x4000000 size 0x4000000 | |
[94167.306747] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: 787 | |
[94167.306749] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: 788 | |
[94167.306751] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: BO hdl 1 map_offset 0x100000000 vaddr 0xffffffffffffffff xdna_addr 0x4000000 | |
[94167.306791] amdxdna_drm_gem_mmap: amdxdna 0000:c5:00.1: 139 | |
[94167.306793] amdxdna_drm_gem_mmap: amdxdna 0000:c5:00.1: mmapping file 00000000efd2531c | |
[94167.306796] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: 253 | |
[94167.306797] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: 254 | |
[94167.306799] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 156 | |
[94167.306800] amdxdna_hmm_register: amdxdna 0000:c5:00.1: hmm registering | |
[94167.306801] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 165 | |
[94167.306802] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 169 | |
[94167.306804] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 171 | |
[94167.306815] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 174 | |
[94167.306817] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 177 | |
[94167.306826] amdxdna_hmm_register: amdxdna 0000:c5:00.1: addr 140222897586176 len 67108864 | |
[94167.306828] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 191 | |
[94167.306829] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 197 | |
[94167.340673] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: BO map_offset 0x100000000 type 2 userptr 0x7f8830000000 size 0x4000000 | |
[94167.340731] amdxdna_flush: amdxdna 0000:c5:00.1: 119 | |
[94167.340734] amdxdna_flush: amdxdna 0000:c5:00.1: PID 148767 flushing... | |
[94167.340807] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: 113 | |
[94167.340810] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: Invalidating range 0x7f8830000000, 0x4000000, type 2 | |
[94167.340813] aie2_hmm_invalidate: amdxdna 0000:c5:00.1: 1032 | |
[94167.340917] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: 113 | |
[94167.340919] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: Invalidating range 0x7f8830000000, 0x4000000, type 2 | |
[94167.340922] aie2_hmm_invalidate: amdxdna 0000:c5:00.1: 1032 | |
[94167.351282] amdxdna_drm_close: amdxdna 0000:c5:00.1: 89 | |
[94167.351289] amdxdna_drm_close: amdxdna 0000:c5:00.1: Closing PID 148767 | |
[94167.351308] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: 66 | |
[94167.351310] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: 67 | |
[94167.351313] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: BO type 2 xdna_addr 0x4000000 | |
[94167.353614] amdxdna_drm_close: amdxdna 0000:c5:00.1: PID 148767 closed | |
[94173.348234] amdxdna_rpmops_suspend: amdxdna 0000:c5:00.1: 227 | |
[94173.348248] aie2_hw_stop: amdxdna 0000:c5:00.1: 359 | |
[94173.348253] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94173.348259] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94173.348296] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d00000d | |
[94173.348457] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d00000d | |
[94173.348490] resp data: 00000000: 00000000 .... | |
[94173.348825] aie2_mgmt_fw_fini: amdxdna 0000:c5:00.1: npu firmware suspended | |
[94173.348831] xdna_mailbox_stop_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: IRQ disabled and RX work cancelled | |
[94173.348941] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d000008 msg opcode 0x10c | |
[94173.348960] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d000009 msg opcode 0x10c | |
[94173.348960] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94173.348963] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000a msg opcode 0x10c | |
[94173.348966] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94173.348969] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000b msg opcode 0x10c | |
[94173.348972] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000c msg opcode 0x10c | |
[94173.348971] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94173.348975] xdna_mailbox_destroy_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: Mailbox channel destroyed, irq: 132 | |
[94173.348975] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94173.348980] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94173.405233] aie2_smu_set_dpm_level: amdxdna 0000:c5:00.1: The dpm level is set to 0 | |
[94173.425248] amdxdna_rpmops_suspend: amdxdna 0000:c5:00.1: Runtime suspend done ret: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[94145.275725] device_type_show: amdxdna 0000:c5:00.1: 18 | |
[94145.276036] amdxdna_drm_open: amdxdna 0000:c5:00.1: 22 | |
[94145.286487] amdxdna_rpmops_resume: amdxdna 0000:c5:00.1: 241 | |
[94145.286495] aie2_hw_start: amdxdna 0000:c5:00.1: 381 | |
[94145.346523] aie2_smu_set_dpm_level: amdxdna 0000:c5:00.1: The dpm level is set to 0 | |
[94145.386463] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: 92 | |
[94145.386472] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x tail 0x2d000 | |
[94145.386477] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x head 0x2d004 | |
[94145.386481] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x ringbuf 0x3d000 | |
[94145.386484] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: i2x rsize 0x400 | |
[94145.386487] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i tail 0x2c000 | |
[94145.386490] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i head 0x2c004 | |
[94145.386494] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i ringbuf 0x3c000 | |
[94145.386497] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i rsize 0x400 | |
[94145.386500] aie2_dump_chann_info_debug: amdxdna 0000:c5:00.1: x2i chann index 0xe | |
[94145.386891] xdna_mailbox_create_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: Mailbox channel created (irq: 132) | |
[94145.386900] aie2_check_protocol_version: amdxdna 0000:c5:00.1: 89 | |
[94145.386904] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.386908] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.386927] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x301 size 4 id 0x1d000000 | |
[94145.386996] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x301 size 12 id 0x1d000000 | |
[94145.387031] resp data: 00000000: 00000000 00000005 00000005 ............ | |
[94145.387070] aie2_check_protocol: amdxdna 0000:c5:00.1: 60 | |
[94145.387074] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387075] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387091] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 12 id 0x1d000001 | |
[94145.387152] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 4 id 0x1d000001 | |
[94145.387172] resp data: 00000000: 00000000 .... | |
[94145.387208] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387211] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387228] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 4 id 0x1d000002 | |
[94145.387308] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 12 id 0x1d000002 | |
[94145.387344] resp data: 00000000: 00000000 00000001 00000000 ............ | |
[94145.387360] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387362] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387370] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 12 id 0x1d000003 | |
[94145.387448] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10a size 4 id 0x1d000003 | |
[94145.387469] resp data: 00000000: 00000000 .... | |
[94145.387485] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387486] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387494] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 4 id 0x1d000004 | |
[94145.387569] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10b size 12 id 0x1d000004 | |
[94145.387604] resp data: 00000000: 00000000 00000001 00000000 ............ | |
[94145.387620] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387621] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387629] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x103 size 4 id 0x1d000005 | |
[94145.387667] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x103 size 4 id 0x1d000005 | |
[94145.387685] resp data: 00000000: 00000000 .... | |
[94145.387698] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387700] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387707] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d000006 | |
[94145.387782] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d000006 | |
[94145.387798] resp data: 00000000: 00000000 .... | |
[94145.387809] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94145.387811] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94145.387817] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x102 size 4 id 0x1d000007 | |
[94145.387894] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x102 size 4 id 0x1d000007 | |
[94145.387903] resp data: 00000000: 00000000 .... | |
[94145.387914] aie2_error_async_events_send: amdxdna 0000:c5:00.1: 275 | |
[94145.387917] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db60000 size 0x2000 | |
[94145.387924] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d000008 | |
[94145.387932] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db62000 size 0x2000 | |
[94145.387936] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d000009 | |
[94145.387939] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db64000 size 0x2000 | |
[94145.387943] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000a | |
[94145.387946] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db66000 size 0x2000 | |
[94145.387951] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000b | |
[94145.387954] aie2_register_asyn_event_msg: amdxdna 0000:c5:00.1: Register addr 0xf6db68000 size 0x2000 | |
[94145.387958] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x10c size 12 id 0x1d00000c | |
[94145.387961] amdxdna_rpmops_resume: amdxdna 0000:c5:00.1: Runtime resume done ret: 0 | |
[94145.388046] amdxdna_drm_open: amdxdna 0000:c5:00.1: PID 148751 opened | |
[94145.388091] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: 648 | |
[94145.388093] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: 649 | |
[94145.388094] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: BO arg type 2 vaddr 0x0 size 0x4000000 flags 0x0 | |
[94145.388096] amdxdna_drm_create_dev_heap: amdxdna 0000:c5:00.1: 489 | |
[94145.388098] amdxdna_drm_create_dev_heap: amdxdna 0000:c5:00.1: 490 | |
[94145.388146] amdxdna_drm_create_bo_ioctl: amdxdna 0000:c5:00.1: BO hdl 1 type 2 userptr 0xffffffffffffffff xdna_addr 0x4000000 size 0x4000000 | |
[94145.388149] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: 787 | |
[94145.388151] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: 788 | |
[94145.388152] amdxdna_drm_get_bo_info_ioctl: amdxdna 0000:c5:00.1: BO hdl 1 map_offset 0x100000000 vaddr 0xffffffffffffffff xdna_addr 0x4000000 | |
[94145.388218] amdxdna_drm_gem_mmap: amdxdna 0000:c5:00.1: 139 | |
[94145.388219] amdxdna_drm_gem_mmap: amdxdna 0000:c5:00.1: mmapping file 00000000d433e765 | |
[94145.388223] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: 253 | |
[94145.388224] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: 254 | |
[94145.388225] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 156 | |
[94145.388227] amdxdna_hmm_register: amdxdna 0000:c5:00.1: hmm registering | |
[94145.388228] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 165 | |
[94145.388229] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 169 | |
[94145.388231] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 171 | |
[94145.388242] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 174 | |
[94145.388243] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 177 | |
[94145.388257] amdxdna_hmm_register: amdxdna 0000:c5:00.1: addr 140457912827904 len 67108864 | |
[94145.388259] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 191 | |
[94145.388260] amdxdna_hmm_register: amdxdna 0000:c5:00.1: 197 | |
[94145.422105] amdxdna_gem_obj_mmap: amdxdna 0000:c5:00.1: BO map_offset 0x100000000 type 2 userptr 0x7fbee8000000 size 0x4000000 | |
[94145.422202] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: 113 | |
[94145.422204] amdxdna_hmm_invalidate: amdxdna 0000:c5:00.1: Invalidating range 0x7fbee8000000, 0x4000000, type 2 | |
[94145.422207] aie2_hmm_invalidate: amdxdna 0000:c5:00.1: 1032 | |
[94145.422222] amdxdna_hmm_unregister: amdxdna 0000:c5:00.1: 135 | |
[94145.422223] amdxdna_hmm_unregister: amdxdna 0000:c5:00.1: hmm unregistering | |
[94145.430577] amdxdna_flush: amdxdna 0000:c5:00.1: 119 | |
[94145.430581] amdxdna_flush: amdxdna 0000:c5:00.1: PID 148751 flushing... | |
[94145.430586] amdxdna_drm_close: amdxdna 0000:c5:00.1: 89 | |
[94145.430587] amdxdna_drm_close: amdxdna 0000:c5:00.1: Closing PID 148751 | |
[94145.430600] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: 66 | |
[94145.430602] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: 67 | |
[94145.430603] amdxdna_gem_obj_free: amdxdna 0000:c5:00.1: BO type 2 xdna_addr 0x4000000 | |
[94145.430652] amdxdna_drm_close: amdxdna 0000:c5:00.1: PID 148751 closed | |
[94151.571167] amdxdna_rpmops_suspend: amdxdna 0000:c5:00.1: 227 | |
[94151.571180] aie2_hw_stop: amdxdna 0000:c5:00.1: 359 | |
[94151.571187] aie2_send_mgmt_msg_wait: amdxdna 0000:c5:00.1: 22 | |
[94151.571192] xdna_send_msg_wait: amdxdna 0000:c5:00.1: 33 | |
[94151.571222] xdna_mailbox_send_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d00000d | |
[94151.571378] mailbox_get_resp: amdxdna 0000:c5:00.1: xdna_mailbox.132: opcode 0x101 size 4 id 0x1d00000d | |
[94151.571419] resp data: 00000000: 00000000 .... | |
[94151.571483] aie2_mgmt_fw_fini: amdxdna 0000:c5:00.1: npu firmware suspended | |
[94151.571498] xdna_mailbox_stop_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: IRQ disabled and RX work cancelled | |
[94151.571635] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d000008 msg opcode 0x10c | |
[94151.571653] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d000009 msg opcode 0x10c | |
[94151.571661] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000a msg opcode 0x10c | |
[94151.571669] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000b msg opcode 0x10c | |
[94151.571677] mailbox_release_msg: amdxdna 0000:c5:00.1: xdna_mailbox.132: msg_id 0x1d00000c msg opcode 0x10c | |
[94151.571685] xdna_mailbox_destroy_channel: amdxdna 0000:c5:00.1: xdna_mailbox.132: Mailbox channel destroyed, irq: 132 | |
[94151.571696] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94151.571707] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94151.571713] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94151.571718] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94151.571723] aie2_error_worker: amdxdna 0000:c5:00.1: 242 | |
[94151.630314] aie2_smu_set_dpm_level: amdxdna 0000:c5:00.1: The dpm level is set to 0 | |
[94151.650175] amdxdna_rpmops_suspend: amdxdna 0000:c5:00.1: Runtime suspend done ret: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: Apache-2.0 | |
// Copyright (C) 2022-2023, Advanced Micro Devices, Inc. All rights reserved. | |
#include <iostream> | |
#include <cstring> | |
#include <string> | |
#include <chrono> | |
/* | |
* This is an example NO-OP test on NPU device. | |
* The application is build with Xilinx Runtime(XRT) APIs. | |
* XRT is open source and it is a submodule of amd-aie repository. | |
* The XRT API document: https://xilinx.github.io/XRT/master/html/index.html | |
*/ | |
// Include XRT headers | |
#include "xrt/xrt_device.h" | |
#include "xrt/xrt_kernel.h" | |
#include "xrt/xrt_bo.h" | |
const int iteration = 1; | |
const int dummy_buffer_size = 4096; /* in bytes */ | |
const int noop_instrction_size = 128; /* in bytes */ | |
int main(int argc, char **argv) | |
{ | |
std::string xclbin_file("/home/mlevental/dev_projects/xdna-driver/example/validate.xclbin"); | |
std::cout << "Host test code start..." << std::endl; | |
std::cout << "Host test code is creating device object..." << std::endl; | |
// On Phoenix, there is only one NPU device, thus the device index will be 0 | |
unsigned int device_index = 0; | |
auto device = xrt::device(device_index); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment