Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to specify build optimization level #18260

Merged
merged 2 commits into from
Feb 25, 2025
Merged

Conversation

nhuang-tt
Copy link
Member

@nhuang-tt nhuang-tt commented Feb 25, 2025

Ticket

#7449

Problem description

Compute kernels are hardcoded to O3. Other kernels are hardcoded toOs.
Users can't benefit from potentially "free" optimization wins because the optimization flag to build their kernels is hardcoded to Os.

What's changed

Add opt_level to kernel config structs. Default to O3 (compute) and Os (data movement, ethernet) if not specified.

Example: The user can specify the data movement kernel to be built with O3 optimization. If this flag isn't specified, it will use the default which is Os.

    KernelHandle void_dataflow_kernel_noc0_id = CreateKernel(
        program,
        "tt_metal/programming_examples/hello_world_datamovement_kernel/kernels/dataflow/void_dataflow_kernel.cpp",
        core,
        DataMovementConfig{
            .processor = DataMovementProcessor::RISCV_0,
            .noc = NOC::RISCV_0_default,
            .opt_level = KernelBuildOptLevel::O3
    });

Checklist

@nhuang-tt nhuang-tt linked an issue Feb 25, 2025 that may be closed by this pull request
@nhuang-tt nhuang-tt force-pushed the nhuang/jit-build-1 branch 3 times, most recently from ce51d39 to 59861b9 Compare February 25, 2025 09:38
Copy link
Contributor

@pgkeller pgkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit

Add a field for users to set the compiler optimization level in
the config passed to CreateKernel

Default is still O3 for compute and Os for rest
@nhuang-tt nhuang-tt merged commit ef1f62a into main Feb 25, 2025
200 of 203 checks passed
@nhuang-tt nhuang-tt deleted the nhuang/jit-build-1 branch February 25, 2025 19:32
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.

fix compile optimization flags
3 participants