Skip to content

Commit a1c8989

Browse files
authored
[smoke-fails] Update tests to use rocprofv3 (#1515)
Older rocprof versions are deprecated, hence tests need updating.
1 parent 6f951de commit a1c8989

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

test/smoke-fails/hsa-lazy-queues/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ TESTSRC_AUX = empty-sink.c
66
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
77

88
AOMPROCM ?= $(AOMPHIP)
9-
ifneq (,$(wildcard $(AOMPROCM)/bin/rocprof))
10-
RUNPROF = $(AOMPROCM)/bin/rocprof
9+
ifneq (,$(wildcard $(AOMPROCM)/bin/rocprofv3))
10+
RUNPROF = $(AOMPROCM)/bin/rocprofv3
1111
else
12-
RUNPROF = $(AOMPROCM)/../bin/rocprof
12+
RUNPROF = $(AOMPROCM)/../bin/rocprofv3
1313
endif
1414

1515
# If 'ROCR_VISIBLE_DEVICES' is empty, default to zero. Otherwise, split on ','
@@ -23,7 +23,7 @@ else
2323
RUNENV = ROCR_VISIBLE_DEVICES=$(DEVICE)
2424
endif
2525

26-
RUNPROF_FLAGS = --hsa-trace
26+
RUNPROF_FLAGS = -o results.json --output-format json --hsa-trace True --stats True --
2727

2828
RUNENV += OMP_NUM_THREADS=2 LIBOMPTARGET_AMDGPU_HSA_QUEUE_BUSY_TRACKING=1
2929
RUNCMD = ./$(TESTNAME) && python3 countQueueCreateEvents.py 2

test/smoke-fails/hsa-lazy-queues/countQueueCreateEvents.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,33 @@
77
parser = argparse.ArgumentParser()
88
parser.add_argument('num_occurences', type=int, help='How many hsa_queue_create events are expected')
99

10-
filename = 'results.json'
10+
filename = 'results.json_results.json'
1111
hsa_queue_create_name = 'hsa_queue_create'
1212

1313
def searchAndCount(TheJSON, args) -> None:
14-
TraceEvents = TheJSON['traceEvents']
14+
Data = TheJSON['rocprofiler-sdk-tool']
15+
for D in Data:
16+
if 'summary' in D:
17+
Summary = D['summary']
1518

16-
ExpectedNumOccurs = args.num_occurences
17-
NumOccurs = 0
18-
for e in TraceEvents:
19-
if len(e) == 0:
19+
for E in Summary:
20+
if E['domain'] != 'HSA_API':
2021
continue
2122

22-
if e['name'] == hsa_queue_create_name:
23-
NumOccurs += 1
23+
Stats = E['stats']
24+
Ops = Stats['operations']
25+
for Op in Ops:
26+
if Op['key'] == hsa_queue_create_name:
27+
NumOccur = Op['value']['count']
28+
# Return error if numbers don't match
29+
sys.exit(NumOccur - args.num_occurences)
2430

25-
if NumOccurs != ExpectedNumOccurs:
26-
sys.exit(1)
31+
# When not found
32+
sys.exit(1)
2733

2834
if __name__ == '__main__':
2935
args = parser.parse_args()
36+
print("Reading JSON file:", filename)
3037
with open(filename, "r") as f:
3138
J = json.load(f)
3239
searchAndCount(J, args)

0 commit comments

Comments
 (0)