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

Add macro to automatically generate common cases for autotune #127

Merged
merged 7 commits into from
Sep 20, 2024

Conversation

wingertge
Copy link
Contributor

Adds a small proc macro to generate the autotune boilerplate in most common cases.
See examples in doc comments for how they would be used.

@nathanielsimard
Copy link
Member

Just to make sure, this creates the tune operation as well as the autotune set from an autotune key, but it doesn't create the high level function actually creating a static tuner right?

@wingertge
Copy link
Contributor Author

wingertge commented Sep 19, 2024

Just to make sure, this creates the tune operation as well as the autotune set from an autotune key, but it doesn't create the high level function actually creating a static tuner right?

Exactly. That boilerplate is extremely minor so I don't think it's worth making a macro for.
Here's an example of the usage in the new conv2d tuner

@nathanielsimard
Copy link
Member

Exactly. That boilerplate is extremely minor so I don't think it's worth making a macro for. Here's an example of the usage in the new conv2d tuner

We could actually generate it as well, since it's the same signature as the tune_set function.

We could have another macro tune that does most of the thing:

#[tune(
    operations(Conv2dDirect, Conv2dIm2col),
    key = create_key,
    inputs = bench_inputs
)]
pub fn conv2d<R: JitRuntime, E: FloatElement, I: IntElement>(
    key: JitAutotuneKey,
    input: JitTensor<R, E, 4>,
    weights: JitTensor<R, E, 4>,
    bias: Option<JitTensor<R, E, 1>>,
    options: ConvOptions<2>,
) -> JitTensor<R, E, 4>;

What do you think?

@nathanielsimard nathanielsimard merged commit ac90bd7 into tracel-ai:main Sep 20, 2024
5 checks passed
@wingertge wingertge deleted the autotune-macro branch September 23, 2024 20:31
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.

2 participants