Skip to content

Fix CUDA arena cfg lifetime, add ROCm dispatch, harden VitisAI LoadLibrary, add missing cctype include - #2041

Merged
baijumeswani merged 2 commits into
baijumeswani/remove-winmlfrom
copilot/sub-pr-2038
Mar 21, 2026
Merged

Fix CUDA arena cfg lifetime, add ROCm dispatch, harden VitisAI LoadLibrary, add missing cctype include#2041
baijumeswani merged 2 commits into
baijumeswani/remove-winmlfrom
copilot/sub-pr-2038

Conversation

Copilot AI commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Addresses review feedback from the EP decoupling PR.

  • CUDA arena cfg use-after-free (src/cuda/session_options.cpp): arena_cfg was scoped inside the if (use_arena_management) block and destroyed before AppendExecutionProvider_CUDA_V2 consumed it. Moved declaration outside the block.

  • ROCm path regression (new src/rocm/session_options.{h,cpp}): ROCm had no dispatch entry and would silently fall through to the generic V2/V1 path, which doesn't support AppendExecutionProvider_ROCM. Added a dedicated provider implementation matching the original behavior, wired into the dispatch table and cmake glob.

  • VitisAI LoadLibrary (src/vitisai/session_options.cpp): LoadLibrary result was unchecked—GetProcAddress would be called with a null handle on failure. Added null-check with error, replaced C-style cast with reinterpret_cast.

  • Missing <cctype> (src/openvino/session_options.cpp): RemoveAllWhitespace calls std::isspace without including <cctype>, relying on transitive includes.

// Before: arena_cfg destroyed before use
if (use_arena_management) {
    auto arena_cfg = OrtArenaCfg::Create(...);
    ort_provider_options->UpdateValue("default_memory_arena_cfg", arena_cfg.get());
}  // arena_cfg destroyed here
session_options.AppendExecutionProvider_CUDA_V2(*ort_provider_options);  // dangling pointer

// After: arena_cfg outlives the append call
std::unique_ptr<OrtArenaCfg> arena_cfg;
if (use_arena_management) {
    arena_cfg = OrtArenaCfg::Create(...);
    ort_provider_options->UpdateValue("default_memory_arena_cfg", arena_cfg.get());
}
session_options.AppendExecutionProvider_CUDA_V2(*ort_provider_options);

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…ch, fix VitisAI LoadLibrary, add cctype include

Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/onnxruntime-genai/sessions/bf3707be-07ba-4dde-babb-cd6a94ca4411
Copilot AI changed the title [WIP] Decouple plugin execution providers from USE_WINML macro Fix CUDA arena cfg lifetime, add ROCm dispatch, harden VitisAI LoadLibrary, add missing cctype include Mar 21, 2026
Copilot AI requested a review from baijumeswani March 21, 2026 08:16
@baijumeswani
baijumeswani marked this pull request as ready for review March 21, 2026 08:16
@baijumeswani
baijumeswani merged commit bc654fd into baijumeswani/remove-winml Mar 21, 2026
1 check passed
@baijumeswani
baijumeswani deleted the copilot/sub-pr-2038 branch March 21, 2026 08:16
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