Skip to content

Conversation

@mawad-amd
Copy link
Collaborator

@mawad-amd mawad-amd commented Aug 27, 2025

Initial version of trace integration with JIT. Here is the output:

In code, it looks like this:

if args.trace_size > 0:
trace.set_trace_size(args.trace_size)
trace.start_trace()
# JIT-compile the kernel then launches the kernel with the given arguments
vector_scalar_mul(input0, scalar, output)
# Stop tracing and save results if tracing was enabled
if args.trace_size > 0:
trace_filename = f"trace_output_{args.num_elements}_{args.data_type}.json"
trace.stop_trace(trace_filename)
print(f"Tracing completed and saved to {trace_filename}")

And this:

worker = Worker(
core_body,
fn_args=[of_in.cons(), of_factor.cons(), of_out.prod(), scale],
trace=1 if trace.get_trace_size() > 0 else 0,
)
# Runtime operations to move data to/from the AIE-array
rt = Runtime()
with rt.sequence(tensor_ty, scalar_ty, tensor_ty) as (A, F, C):
if trace.get_trace_size() > 0:
rt.enable_trace(trace.get_trace_size())

I would have liked to hide this away too but it's not straight forward at the moment because of how the default workflow works (i.e., I can't simply call enable_trace for the runtime sequence if tracing is enabled in the backend). There are also other complications for tracing that Jack has brought up.

Output trace visualization:
image

@mawad-amd
Copy link
Collaborator Author

@jackl-xilinx @AndraBisca @jgmelber This is an initial draft for trace support in JIT.

@mawad-amd mawad-amd mentioned this pull request Aug 28, 2025
@mawad-amd mawad-amd mentioned this pull request Oct 2, 2025
6 tasks
@hunhoffe hunhoffe added this to the JIT/Runtime/Compilation Refactor milestone Nov 10, 2025
@hunhoffe hunhoffe removed this from the JIT/Runtime/Compilation Refactor milestone Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants