Skip to content

feat: Add `.MemberIsNullIs[type] Functions to TritonJson#157

Merged
whoisj merged 4 commits into
mainfrom
jwyman/triton_json/add-member_is_null
May 5, 2026
Merged

feat: Add `.MemberIsNullIs[type] Functions to TritonJson#157
whoisj merged 4 commits into
mainfrom
jwyman/triton_json/add-member_is_null

Conversation

@whoisj
Copy link
Copy Markdown
Contributor

@whoisj whoisj commented Apr 24, 2026

This change adds a set of .MemberIs[type] functions to TritonJson.

  • MemberIsArray(const char* name) const
  • MemberIsArray(const std::string& name) const
  • MemberIsNull(const char* name) const
  • MemberIsNull(const std::string& name) const
  • MemberIsObject(const char* name) const
  • MemberIsObject(const std::string& name) const
  • MemberIsString(const char* name) const
  • MemberIsString(const std::string& name) const

These new methods are used in parsing of the JSON blobs returned by PyTorch's AOTInductorContainerRunner::get_call_spec() function to determine the interface the model supports.

This change adds a set of .MemberIs[type] functions to TritonJson.

* MemberIsArray(const char* name) const
* MemberIsArray(const std::string& name) const
* MemberIsNull(const char* name) const
* MemberIsNull(const std::string& name) const
* MemberIsObject(const char* name) const
* MemberIsObject(const std::string& name) const
* MemberIsString(const char* name) const
* MemberIsString(const std::string& name) const

These new methods are used in parsing of the JSON blobs returned by PyTorch's AOTInductorContainerRunner::get_call_spec() function
to determine the interface the model supports.
@whoisj whoisj added the enhancement New feature or request label Apr 24, 2026
@yinggeh yinggeh requested a review from Copilot April 30, 2026 00:40
yinggeh
yinggeh previously approved these changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@yinggeh yinggeh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds member-level JSON type-check helpers to TritonJson to simplify parsing object members returned by PyTorch’s AOTInductorContainerRunner::get_call_spec().

Changes:

  • Added MemberIsArray/Null/Object/String overloads for const char* and std::string member names.
  • Implemented these checks as safe guards that return false when the value isn’t an object or the member is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/triton/common/triton_json.h Outdated
Comment thread include/triton/common/triton_json.h
Comment thread include/triton/common/triton_json.h Outdated
Comment thread include/triton/common/triton_json.h Outdated
Comment thread include/triton/common/triton_json.h
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
whoisj and others added 2 commits May 4, 2026 11:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@whoisj whoisj requested a review from yinggeh May 4, 2026 15:31
{
const rapidjson::Value& object = AsValue();
if (!object.IsObject() || !object.HasMember(name))
if (!object.IsObject() || !object.HasMember(name)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch. We should never do no-block one-liner.

@whoisj whoisj merged commit ecb874c into main May 5, 2026
1 check passed
@whoisj whoisj deleted the jwyman/triton_json/add-member_is_null branch May 5, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

3 participants