Skip to content

Conversation

@antonysigma
Copy link
Contributor

Search the first 5 lines of the device code for the keyword using namespace metal. If it exists, invoke the syntax highlighting for Metal/C language.

(Used to debug the threads_budget for Metal GPUs. #8650 (comment))

Screenshot:
image

cc'ed @mcourteaux .

Search the first 5 lines of the device code for the keyword `using
namespace metal`. If it exists, invoke the syntax highlighting for
Metal/C++ language.
Copy link
Contributor

@mcourteaux mcourteaux left a comment

Choose a reason for hiding this comment

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

Very cool! Thanks.

Two requests for change:

  1. Can you rename the function to highlightDeviceCode(), and support both Metal and OpenCL. You can simply check the first line to contain OpenCL.
  2. Fix the indent of the function and the call to it.

@antonysigma antonysigma marked this pull request as ready for review June 25, 2025 23:14
Copy link
Contributor Author

@antonysigma antonysigma left a comment

Choose a reason for hiding this comment

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

Hi @mcourteaux ,

I also applied syntax highlighting for OpenCL code. Thanks!

-Antony

@antonysigma antonysigma force-pushed the highlight-metal-device-code branch from 1a0ee08 to 023cad0 Compare June 25, 2025 23:18
@mcourteaux
Copy link
Contributor

Thanks. You didn't indent the code tho. Everything inside the <script> tag should be indented.

Copy link
Contributor Author

@antonysigma antonysigma left a comment

Choose a reason for hiding this comment

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

Thanks. You didn't indent the code tho. Everything inside the <script> tag should be indented.

Done. Please review it again.

@mcourteaux mcourteaux merged commit eb4869d into halide:main Jun 26, 2025
0 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants