Skip to content

Follow-up to PR#4266 - Addressing review comments#4275

Open
khalatepradnya wants to merge 2 commits intoNVIDIA:mainfrom
khalatepradnya:fix-measurements-size-review
Open

Follow-up to PR#4266 - Addressing review comments#4275
khalatepradnya wants to merge 2 commits intoNVIDIA:mainfrom
khalatepradnya:fix-measurements-size-review

Conversation

@khalatepradnya
Copy link
Copy Markdown
Collaborator

@khalatepradnya khalatepradnya commented Apr 7, 2026

* Remove redundant check
* Fix the pattern(s) by pre-declaring functions so we don't have multiple threads try to update a ModuleOp at the same time

Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
github-actions bot pushed a commit that referenced this pull request Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Comment on lines +191 to +193
cudaq::opt::factory::createLLVMFunctionSymbol(
cudaq::opt::QIRArrayGetSize, IntegerType::get(context, 64),
{cudaq::opt::getArrayType(context)}, op);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should use the intrinsics loading machinery for this if we can. It will properly deal with redundant declarations, etc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I tried using IRBuilder::loadIntrinsic here but it crashes with Loading a dialect (cc) while in a multi-threaded execution context. Adding cc and func to dependentDialects fixes that, but then applyFullConversion hits "redefinition of symbol". I think because createLLVMFunctionSymbol misses the func.func from loadIntrinsic and creates a duplicate.

A potential fix would be to widen createLLVMFunctionSymbol such that it also finds func::FuncOp declarations, but that change is pervasive, and I wasn't sure whether it is right approach.
Any pointers?

github-actions bot pushed a commit that referenced this pull request Apr 10, 2026
@github-actions
Copy link
Copy Markdown

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

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