Skip to content

Invalid Format Specifier for print_memory_profiler_info() #8663

Open

Description

@fangjunzhou

Describe the bug

ti.profiler.memory_profiler.print_memory_profiler_info() seems to be broken with RuntimeError: invalid format specifier error message.

To Reproduce

Run the following code:

import taichi.profiler as profiler

ti.init(arch=ti.cpu, debug=True)

profiler.print_memory_profiler_info()

Log/Screenshots

    def print_memory_profiler_info():
        """Memory profiling tool for LLVM backends with full sparse support.

        This profiler is automatically on.
        """
        get_runtime().materialize()
>       get_runtime().prog.print_memory_profiler_info()
E       RuntimeError: invalid format specifier

.venv/lib/python3.12/site-packages/taichi/profiler/memory_profiler.py:10: RuntimeError

Activity

  1. hughperkins commented on Apr 27, 2025

    @hughperkins
    Contributor

    works ok for me on python 3.10 on arm64 mac

    [Taichi Build] Hughs-MacBook-Air:taichi hugh$ python ~/git/taichi-play/8663.py
    [Taichi Build] Hughs-MacBook-Air:taichi hugh$
    

    I wonder if it's related to python version? What happens if you use python 3.10?

  2. hughperkins commented on Apr 30, 2025

    @hughperkins
    Contributor

    Actually, I don't know what I was doing before, but I get the same error now 🤔 (Actually, I re-found this when googling the error 😅)

  3. NathanaelJ commented on May 18, 2026

    @NathanaelJ

    I also get this issue. Would love to find out a solution... My setup is:
    [Taichi] version 1.7.3, llvm 15.0.4, commit 5ec301be, linux, python 3.10.12

    The profiler prints some information before the error occurs:

    [Memory Profiler]
    SNode S0root    
    SNode S1dense   
    SNode S3root    
    SNode S4dense   
    SNode S8dense   
    SNode S12dense  
    SNode S16dense  
    SNode S18root   
    SNode S19dense  
    SNode S84root   
    SNode S85dense  
    SNode S87root   
    SNode S88dense  
    SNode S92root   
    SNode S93dense  
    SNode S95root   
    SNode S96dense  
    SNode S100dense 
    SNode S104root  
      active element list:╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
    ...
    

    I took a look at the function in taichi/runtime/llvm/llvm_runtime_executor.cpp and it looks like the issue could be the :n in lines 363 and 364. :n was deprecated in fmt verison 8.0 (and subsequently removed) and should be changed to :L

    Seems like a relatively easy fix if anyone wants to actually give it a go?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions