Skip to content

Conversation

smedhe
Copy link

@smedhe smedhe commented Aug 19, 2025

This PR updates QEff to support QPC generation on systems without the Platform SDK by refactoring the module loading behavior. Users can now compile models and generate QPCs using QEff with only the Apps SDK installed.

Background: Previously, both Apps SDK and Platform SDK were required to compile and generate QPCs using QEff. The goal is to allow QPC generation with only the Apps SDK installed for systems without Ultra cards.
Changes:
Refactored init.py and generation/cloud_infer.py to use lazy loading via importlib for qaicrt and aicapi.
This ensures that Platform SDK-dependent modules are only loaded when explicitly needed, avoiding import errors during initialization and QPC generation.

Copy link
Contributor

@quic-akuruvil quic-akuruvil left a comment

Choose a reason for hiding this comment

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

Please provide a full description of the significance/purpose of this PR.

Signed-off-by: Sharvari Medhe <[email protected]>
Copy link
Contributor

@ochougul ochougul left a comment

Choose a reason for hiding this comment

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

Please test this on a system where apps sdk is not installed the expected behaviour is
if sdk is not installed , qeff works till export, and fails at compile, execute

Signed-off-by: Sharvari Medhe <[email protected]>
Comment on lines 29 to 34
try:
import QAicApi_pb2 as aicapi
except ImportError:
import sys

sys.path.append("/opt/qti-aic/dev/python")
import QAicApi_pb2 as aicapi

aic_to_np_dtype_mapping = {
aicapi.FLOAT_TYPE: np.dtype(np.float32),
aicapi.FLOAT_16_TYPE: np.dtype(np.float16),
aicapi.INT8_Q_TYPE: np.dtype(np.int8),
aicapi.UINT8_Q_TYPE: np.dtype(np.uint8),
aicapi.INT16_Q_TYPE: np.dtype(np.int16),
aicapi.INT32_Q_TYPE: np.dtype(np.int32),
aicapi.INT32_I_TYPE: np.dtype(np.int32),
aicapi.INT64_I_TYPE: np.dtype(np.int64),
aicapi.INT8_TYPE: np.dtype(np.int8),
}
try:
sys.path.append("/opt/qti-aic/dev/python")
import QAicApi_pb2 as aicapi
Copy link
Contributor

Choose a reason for hiding this comment

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

add is_aicapi_imported=True here

Copy link
Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Sharvari Medhe <[email protected]>
Copy link
Contributor

@ochougul ochougul left a comment

Choose a reason for hiding this comment

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

just one comment on verbose, everything else LGTM.
can be merged once CI passes.

@smedhe smedhe marked this pull request as ready for review September 8, 2025 11:26
Signed-off-by: Sharvari Medhe <[email protected]>
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.

6 participants