Skip to content
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

allow setting runtime handles #997

Closed
wants to merge 2 commits into from
Closed

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Oct 18, 2024

Sometimes we need to set runtime data (which cannot be written in a config file) into ORT's session options. This change introduces this RuntimeSettings type, together with internal implementation and C-API, C++-API.

@guschmue
Copy link
Contributor

Lgtm.

@fs-eire fs-eire marked this pull request as ready for review October 19, 2024 00:05
@fs-eire fs-eire changed the title [WIP] allow setting runtime handles allow setting runtime handles Oct 19, 2024
src/config.cpp Show resolved Hide resolved
src/config.cpp Show resolved Hide resolved
src/config.cpp Show resolved Hide resolved
@fs-eire
Copy link
Contributor Author

fs-eire commented Oct 22, 2024

close this. replaced by #1002

@fs-eire fs-eire closed this Oct 22, 2024
fs-eire added a commit that referenced this pull request Oct 24, 2024
This PR is an alternative way of
#997 to implement
allowing users to set runtime handles.

The basic idea is to create a JSON string representing the `Config`
class from the `RuntimeSettings`, and the `Config` class will merge
them.

Currently this PR is not working because of the following:
- The existing JSON parser does not support multiple entries in
`provider_options`
  The following JSON will fail to parse.
  ```json
  {
    "model": {
        "decoder": {
            "session_options": {
                "provider_options": [
                    {
                        "webgpu": { }
                    },
                    {
                        "dml": {}
                    }
                ]
            },
        },
     },
  }

  ```

- When trying to specify JSON overlay, two "webgpu" items does not
merge.
  genai_config.json:
  ```json
  {
    "model": {
        "decoder": {
            "session_options": {
                "provider_options": [
                    {
                        "webgpu": { "abc": "123" }
                    }
                ]
            },
        },
     },
  }

  ```

  generated overlay config:
  ```
  {
    "model": {
      "decoder": {
        "session_options": {
          "provider_options": [
            {
              "webgpu": {
                "dawnProcTable": "12345678"
              }
            }
          ]
        }
      }
    }
  }
  ```

  Result:
  

![image](https://github.com/user-attachments/assets/adf649bd-8d7b-4b2e-a8f8-6141d04eb7ee)

This PR depends on a code change to the Config class to support the
expected parsing behaviors.

---------

Co-authored-by: Ryan Hill <[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.

3 participants