cutlass icon indicating copy to clipboard operation
cutlass copied to clipboard

[QST] Unify The Color for Latex and SVG Print

Open reed-lau opened this issue 1 year ago • 6 comments

What is your question?

With the release of Cutlass 3.6, the print_latex function now allows users to specify colors using a template parameter. However, the print_svg function's color is still hardcoded. To enhance its usability, we should extend the color parameterization feature to print_svg.

We'll first examine how print_latex handles color. It uses the TikzColorFn class as the template parameter for print_latex, which provides a color string for LaTeX TikZ format (e.g., {rgb,255:red,175;green,175;blue,255}) through the TikzColor_TV structure's operator() function.

I propose two approaches:

  1. Define SvgColorFn and SvgColor_TV similar to TikzColorFn and TikzColor_TV, returning SVG-compatible color strings (e.g., rgb(255,175,175)). Pros: Easy to code; can be implemented by copying and modifying existing code. Cons: Color definitions would be duplicated for LaTeX and SVG.
  2. Create a unified ColorFn and ColorTV that return RGB values (int values, not color strings specific to TikZ or SVG). The print_latex/svg functions would then construct the color strings for LaTeX and SVG. Pros: A unified color representation (RGB tuple with int type), making it easier for future users. Cons: More complex coding required:
    • Change TikzColor_TV to Color_TV.
    • Convert TikzColor_TV's color strings to pure RGB tuples.
    • Modify the operator() function to return RGB values(eg. void operator(int tid, int vid, int &r, int &g, int &b)).
    • Have print_latex and print_svg construct their own color strings.
    • Rename the template parameter from TikzColorFn to ColorFn.
    • Unify TikzColorWhite and TikzColorBWx8 to RGB tuple representations.

I advocate for the second approach. What are your thoughts?

Reference: https://github.com/NVIDIA/cutlass/pull/1733

reed-lau avatar Oct 11 '24 03:10 reed-lau

@hwu36

reed-lau avatar Oct 11 '24 03:10 reed-lau

@ccecka

hwu36 avatar Oct 11 '24 04:10 hwu36

@hwu36 could you help to move this forward?"

reed-lau avatar Oct 22 '24 10:10 reed-lau

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Nov 21 '24 10:11 github-actions[bot]

Can font be configured in SVG? Because there is no font configuration, the SVG is displayed differently in different environments.

leimao avatar Jan 03 '25 17:01 leimao

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Feb 02 '25 19:02 github-actions[bot]

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] avatar May 03 '25 20:05 github-actions[bot]

@thakkarV could you help? (I can't @ ccecka.)

reed-lau avatar May 06 '25 03:05 reed-lau

@reed-lau Hi, we are very busy with prepping the release of 4.0. We don't have the b/w to work on this at the moment since this is low priority. Is this something of urgent need for you?

thakkarV avatar May 06 '25 14:05 thakkarV

@reed-lau Hi, we are very busy with prepping the release of 4.0. We don't have the b/w to work on this at the moment since this is low priority. Is this something of urgent need for you?

Thanks for the update. I understand, and I’m not in a hurry. Please take your time.

reed-lau avatar May 07 '25 10:05 reed-lau