Skip to content

[Bug] Fix memory profiler number formatting - #818

Merged
hughperkins merged 7 commits into
Genesis-Embodied-AI:mainfrom
btgaskin:agent/fix-memory-profiler-format
Aug 28, 2026
Merged

[Bug] Fix memory profiler number formatting#818
hughperkins merged 7 commits into
Genesis-Embodied-AI:mainfrom
btgaskin:agent/fix-memory-profiler-format

Conversation

@btgaskin

@btgaskin btgaskin commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Updates the memory profiler's locale-aware integer formatting for bundled fmt 10 and exercises the sparse-tree output paths in a CPU regression test.

Originally reported in taichi-dev/taichi#8663.

This fixes profiler output only; it does not change allocator lifetimes.

Checks: editable build; memory-profiler test (1 passed); pre-commit.

@hughperkins

Copy link
Copy Markdown
Collaborator

Hi, I notice this is marked 'draft'. Is that intentional? If so, I'll wait till it is in 'ready for review' before proceeding further.

@hughperkins

Copy link
Copy Markdown
Collaborator

(notably, I cannot run @codex review, until PR is marked 'ready for review')

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@hughperkins hughperkins added the awaiting-contributor-action awaiting-contributor-action label Jul 27, 2026
@btgaskin
btgaskin marked this pull request as ready for review August 11, 2026 04:12
@btgaskin

Copy link
Copy Markdown
Contributor Author

My apologies, @hughperkins ! I've marked this and #817 ready for review now

@hughperkins

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b06ddc71c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

fb.finalize()
x[0] = 1

qd.profiler.print_memory_profiler_info()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid requiring an installed en_US locale in this test

On systems without the exact en_US.UTF-8 locale—such as the provided Linux environment, whose locale -a only lists C, C.utf8, and POSIX—this call throws from std::locale("en_US.UTF-8") in LlvmRuntimeExecutor::print_memory_profiler_info() before reaching the corrected format strings. Because the new CPU test has no locale guard or fallback, it introduces a platform-dependent test failure and leaves the profiler unusable in those installations; the implementation should format with a locally available/fallback locale rather than assuming this named locale exists.

Useful? React with 👍 / 👎.

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.

Opus concurs with codex:

Screenshot 2026-08-24 at 09 02 12 Screenshot 2026-08-24 at 09 02 28

Please could you take a look? (Or I can get Opus to address this, if you prefer?)

@hughperkins

Copy link
Copy Markdown
Collaborator

Asked opus about this PR. It says the PR looks good, and fixes an actual hard crash.

Screenshot 2026-08-24 at 08 54 25 Screenshot 2026-08-24 at 08 54 58

@hughperkins

Copy link
Copy Markdown
Collaborator

Please could you check the codex comment above?

Replace the {:L}/global-locale approach in the memory profiler with
fmt::group_digits(...), which inserts thousand separators
locale-independently. This removes the process-wide
std::locale::global(std::locale("en_US.UTF-8")) mutation and its hard
dependency on the en_US.UTF-8 locale being installed, which threw
std::runtime_error (crashing the profiler and the new CPU test) on hosts
that only ship C / C.UTF-8 / POSIX locales.
Comment thread quadrants/runtime/llvm/llvm_runtime_executor.cpp Outdated
Pack the explanatory comment lines nearer the project's 120-char width
instead of leaving them short.
@hughperkins

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: cb1a413888

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@hughperkins

Copy link
Copy Markdown
Collaborator

Once agent has removed the superfluous comment, I think I'll wait for CI to ~green, then merge

fmt::group_digits(...) is self-documenting; the explanatory comment adds
no information.
@hughperkins hughperkins added awaiting-ci-to-pass awaiting-ci-to-pass docs-reviewed-ok and removed awaiting-contributor-action awaiting-contributor-action labels Aug 28, 2026
@hughperkins
hughperkins merged commit 1dfe12d into Genesis-Embodied-AI:main Aug 28, 2026
57 of 66 checks passed
@hughperkins

Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants