Skip to content

Adding aic-hw-version Compile Options Support #528

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abukhoy
Copy link
Contributor

@abukhoy abukhoy commented Aug 4, 2025

This pull request introduces compile-time options as kwargs, aic-hw-version support which takes value ai200 or 2.0.

These changes allow users to customize the compile Api according to their requirements.

Example:

from QEfficient import QEFFAutoModelForCausalLM
from transformers import AutoTokenizer

model_name = "gpt2"
model = QEFFAutoModelForCausalLM.from_pretrained(model_name, num_hidden_layers=2)

model.compile(prefill_seq_len=128, ctx_len=256, num_cores=16, num_devices=1, **{'aic-hw-version':'2.0'})

tokenizer = AutoTokenizer.from_pretrained(model_name)
model.generate(prompts=["Hi there!!"], tokenizer=tokenizer)

@@ -276,7 +276,11 @@ def _compile(

return self.qpc_path

command = constants.COMPILER + [f"-m={onnx_path}"]
command = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just pop the compiler_options and append to command like we are doing for other compiler options. That way code will be cleaner imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we pop compiler options one by one, then number of lines will increase, and AIC compiler tool support many other options which would be limited.

Signed-off-by: Abukhoyer Shaik <[email protected]>
@abukhoy
Copy link
Contributor Author

abukhoy commented Aug 6, 2025

I have made a little change to the _compile function of the base class by including some helper method. If it's not okay then I will revert it.

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.

4 participants