CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
105 lines
1.9 KiB
ArmAsm
105 lines
1.9 KiB
ArmAsm
# REQUIRES: aarch64
|
|
|
|
## Generate a large test case and check that the output is deterministic.
|
|
|
|
# RUN: %python %s %t.s %t.proftext
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=aarch64 %t.s -o %t.o
|
|
# RUN: llvm-profdata merge %t.proftext -o %t.profdata
|
|
|
|
# RUN: ld.lld --icf=all -o %t1.o %t.o --irpgo-profile=%t.profdata --bp-startup-sort=function --bp-compression-sort-startup-functions --bp-compression-sort=both
|
|
# RUN: ld.lld --icf=all -o %t2.o %t.o --irpgo-profile=%t.profdata --bp-startup-sort=function --bp-compression-sort-startup-functions --bp-compression-sort=both
|
|
# RUN: cmp %t1.o %t2.o
|
|
|
|
import random
|
|
import sys
|
|
|
|
assembly_filepath = sys.argv[1]
|
|
proftext_filepath = sys.argv[2]
|
|
|
|
random.seed(1234)
|
|
num_functions = 1000
|
|
num_data = 100
|
|
num_traces = 10
|
|
|
|
function_names = [f"f{n}" for n in range(num_functions)]
|
|
data_names = [f"d{n}" for n in range(num_data)]
|
|
profiled_functions = function_names[: int(num_functions / 2)]
|
|
|
|
function_contents = [
|
|
f"""
|
|
{name}:
|
|
add w0, w0, #{i % 4096}
|
|
add w1, w1, #{i % 10}
|
|
add w2, w0, #{i % 20}
|
|
adrp x3, {name}
|
|
ret
|
|
"""
|
|
for i, name in enumerate(function_names)
|
|
]
|
|
|
|
data_contents = [
|
|
f"""
|
|
{name}:
|
|
.ascii "s{i % 2}-{i % 3}-{i % 5}"
|
|
.xword {name}
|
|
"""
|
|
for i, name in enumerate(data_names)
|
|
]
|
|
|
|
trace_contents = [
|
|
f"""
|
|
# Weight
|
|
1
|
|
{", ".join(random.sample(profiled_functions, len(profiled_functions)))}
|
|
"""
|
|
for i in range(num_traces)
|
|
]
|
|
|
|
profile_contents = [
|
|
f"""
|
|
{name}
|
|
# Func Hash:
|
|
{i}
|
|
# Num Counters:
|
|
1
|
|
# Counter Values:
|
|
1
|
|
"""
|
|
for i, name in enumerate(profiled_functions)
|
|
]
|
|
|
|
with open(assembly_filepath, "w") as f:
|
|
f.write(
|
|
f"""
|
|
.text
|
|
.globl _start
|
|
|
|
_start:
|
|
ret
|
|
|
|
{"".join(function_contents)}
|
|
|
|
.data
|
|
{"".join(data_contents)}
|
|
|
|
"""
|
|
)
|
|
|
|
with open(proftext_filepath, "w") as f:
|
|
f.write(
|
|
f"""
|
|
:ir
|
|
:temporal_prof_traces
|
|
|
|
# Num Traces
|
|
{num_traces}
|
|
# Trace Stream Size:
|
|
{num_traces}
|
|
|
|
{"".join(trace_contents)}
|
|
|
|
{"".join(profile_contents)}
|
|
"""
|
|
)
|