Skip to content

[Bug][Frontend] TOG host C flags hard-coded to debug -Og via 'if True:' #239

Closed

Description

@YWHyuk

Summary

PyTorchSimFrontend/extension_config.py:14-24 carries a left-over if True: so the host CFLAGS for the dlopen-ed *_tog.so / tile_operation_graph.so are permanently -g -Og -fno-omit-frame-pointer .... The release branch (-O2 ...) is unreachable.

Code

def _default_tog_host_cflags():
    if os.environ.get("TORCHSIM_TOG_HOST_CFLAGS"):
        return os.environ["TORCHSIM_TOG_HOST_CFLAGS"]
    if True: #int(os.environ.get("TORCHSIM_TOG_SO_DEBUG", "0")):
        return (
            "-g -Og -fno-omit-frame-pointer -fPIC -std=c11 "
            "-Wall -Wextra -Wno-unused-variable -Wno-unused-parameter"
        )
    return (
        "-O2 -fPIC -std=c11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter"
    )

Suggested fix

Restore the original guard:

if int(os.environ.get("TORCHSIM_TOG_SO_DEBUG", "0")):
    return ("-g -Og -fno-omit-frame-pointer ...")
return ("-O2 -fPIC ...")

Why this matters

Every TOG .so produced by extension_codecache is compiled at -Og with debug symbols. This is dead-weight CPU + memory cost for every TOGSim run (large models compile and load these .so files repeatedly). The release path should be the default; TORCHSIM_TOG_SO_DEBUG=1 is the existing opt-in for debug builds.

Git context

Likely introduced as a temporary debugging override that was never reverted. Worth checking git log -p PyTorchSimFrontend/extension_config.py for context.

Activity

  1. added
    bug
    on May 26, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions