Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions jax_rocm_plugin/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ def add_artifact_subcommand_arguments(parser: argparse.ArgumentParser):
default="",
help="Path to the ROCm toolkit.",
)
rocm_group.add_argument(
"--preserve_debug_symbols",
type=bool,
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

Using type=bool for argparse arguments doesn't work as expected. In Python's argparse, bool() will return True for any non-empty string, including "False" or "false". This means passing --preserve_debug_symbols=false will still evaluate to True.

Consider using one of these patterns instead:

  1. Use action="store_true" with default=False if you want a simple flag that enables the feature when present
  2. Use type=utils._parse_string_as_bool (like the --use_clang argument on line 260) if you want to accept string values like "true"/"false"
  3. Use action=argparse.BooleanOptionalAction (Python 3.9+) which automatically creates --preserve_debug_symbols and --no-preserve_debug_symbols flags

Given that the default is True and this is meant to be configurable, option 2 would be most consistent with the existing codebase.

Suggested change
type=bool,
type=utils._parse_string_as_bool, # pylint: disable=protected-access

Copilot uses AI. Check for mistakes.
default=True,
help="Preserve debug symbols in the generated SO files",
)

# Compile Options
compile_group = parser.add_argument_group("Compile Options")
Expand Down Expand Up @@ -598,6 +604,8 @@ async def main():
)

if "rocm" in args.wheels:
if args.preserve_debug_symbols:
wheel_build_command_base.append("--config=debug_symbols")
wheel_build_command_base.append("--config=rocm_base")
if args.use_clang:
wheel_build_command_base.append("--config=rocm")
Expand Down