Skip to content

[Bug Fix]: qpc sdk config dump issue fixing #379

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

abukhoy
Copy link
Contributor

@abukhoy abukhoy commented Apr 23, 2025

This PR addresses an issue causing the qconfig dump to fail when QAIC is not installed but QNN is present. With this update, the qconfig will be successfully dumped in both QAIC and QNN environments.

abukhoy added 6 commits March 6, 2025 15:35
Signed-off-by: Abukhoyer Shaik <quic_abukhoye@quicinc.com>
Signed-off-by: Abukhoyer Shaik <quic_abukhoye@quicinc.com>
Signed-off-by: Abukhoyer Shaik <quic_abukhoye@quicinc.com>
Signed-off-by: Abukhoyer Shaik <quic_abukhoye@quicinc.com>
Signed-off-by: Abukhoyer Shaik <quic_abukhoye@quicinc.com>
)
qnn_sdk_yaml_path = os.path.join(qnn_sdk_path, QnnConstants.QNN_SDK_YAML)
with open(qnn_sdk_yaml_path, "r") as file:
qnn_sdk_details = yaml.safe_load(file)
Copy link
Contributor

Choose a reason for hiding this comment

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

qnn_sdk_details is not declared earlier, what if qnn_sdk_yaml_path is None, then this variable will not be initialized and will give error at line 544. Please declare qnn_sdk_details = None before file open.

else None
)
qaic_version = None
if sdk_xml_file is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

What if sdk_xml_file is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then aic_version would be None.

@@ -492,7 +492,7 @@ def create_and_dump_qconfigs(
many other compilation options.
"""
qnn_config = compiler_options["qnn_config"] if "qnn_config" in compiler_options else None
enable_qnn = True if "qnn_config" in compiler_options else None
enable_qnn = True if "qnn_config" in compiler_options else False
Copy link
Contributor

Choose a reason for hiding this comment

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

are we supposed to check 'qnn_config' or 'enable_qnn' compiler_options here? we set enable_qnn flag for switching between qnn and qaic workflow. qnn_config is an optional parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this qconfig_dump function is being called from QEFFBaseModel's _compile method in which we have qnn_config and enable_qnn params. Here, we need for dumping the specific configs whether it is aic or qnn.

@@ -492,7 +492,7 @@ def create_and_dump_qconfigs(
many other compilation options.
"""
qnn_config = compiler_options["qnn_config"] if "qnn_config" in compiler_options else None
Copy link
Contributor

Choose a reason for hiding this comment

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

you can replace it as compiler_options.get("qnn_config", None)

f"QNN_SDK_PATH {qnn_sdk_path} is not set. Please set {QnnConstants.QNN_SDK_PATH_ENV_VAR_NAME}"
)
qnn_sdk_yaml_path = os.path.join(qnn_sdk_path, QnnConstants.QNN_SDK_YAML)
with open(qnn_sdk_yaml_path, "r") as file:
Copy link
Contributor

Choose a reason for hiding this comment

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

better to create a load yaml method. Check if the file is available, add proper exception handling and load the yaml file. if there is an uncaught exception in this method it will impact the complete run.

else:
# Extract QAIC SDK Apps or Platform Version from SDK XML file
sdk_xml_file = (
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. create a method for fetching the apps and platform sdk.
  2. Its better to capture platform sdk as well if its installed. it will be useful while debugging

root = tree.getroot()
qaic_version = root.find(".//base_version").text

aic_compiler_config = {
Copy link
Contributor

Choose a reason for hiding this comment

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

These details will not be captured while qnn is enabled. Which is not correct. its better to keep sdk check and others outside as we had done it earlier. if SDK are installed, we will capture that

@quic-rishinr quic-rishinr marked this pull request as draft April 25, 2025 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants