Skip to content

fix: tex_ts::te_gemm_ts missing dtype#142

Merged
ajassani merged 3 commits intomainfrom
fix/te_ops_byte_missing_dtype
May 8, 2025
Merged

fix: tex_ts::te_gemm_ts missing dtype#142
ajassani merged 3 commits intomainfrom
fix/te_ops_byte_missing_dtype

Conversation

@olehtika
Copy link
Copy Markdown
Contributor

@olehtika olehtika commented May 8, 2025

Fix missing dtype in bytes calculation when calculating output dtype

@olehtika olehtika requested review from ajassani and jasainio May 8, 2025 13:12
4: ['float', 'scalar'],
2: ['c10::half', 'c10::bfloat16'],
1: ['c10::float8_e4m3fnuz'],
1: ['c10::float8_e4m3fnuz', 'unsigned char'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we have any other data types that we could already add here?

Copy link
Copy Markdown
Collaborator

@ajassani ajassani left a comment

Choose a reason for hiding this comment

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

I dont think we need to make an assumptionabut the out dtype as
output dtype is the index 10 in event["args"]["Input type"]

else:
# assume output dtype lowest of inputs, ignore scalars alpha and beta for now
# TODO: correct later if better way found
self.bpe_output = min(self.bpe_mat1, self.bpe_mat2, self.bpe_bias)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dont think we need to make an assumption here as
output dtype is the index 10 in event["args"]["Input type"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or is it bias dtype?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now included output dtype

@ajassani ajassani requested a review from Copilot May 8, 2025 19:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the missing dtype issue in the calculation of bytes per element by updating the dtype mappings and how input types are handled.

  • Extend dtype mapping to include 'unsigned char'
  • Update input type tuple to include output and bias dtypes
  • Adjust the bytes computation logic to use the new tuple structure
Comments suppressed due to low confidence (2)

TraceLens/PerfModel/perf_model.py:503

  • Verify that the ordering in the input type tuple accurately reflects the intended mapping for A, B, output, and bias, particularly ensuring that index 10 corresponds to the output dtype and index 18 to the bias dtype.
dtype_A_B = (event['args']['Input type'][0], event['args']['Input type'][5], event['args']['Input type'][10], event['args']['Input type'][18])

TraceLens/PerfModel/perf_model.py:519

  • Confirm that the removal of the min() function and the direct mapping for output dtype are correct and consistent with the intended behavior, ensuring no additional logic is now required.
self.bpe_output = name2bpe(dtype_A_B[2])

@@ -39,7 +39,7 @@ def name2bpe(name):
8: ['double', 'long int'],
4: ['float', 'scalar'],
2: ['c10::half', 'c10::bfloat16'],
Copy link

Copilot AI May 8, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a comment to clarify the inclusion of 'unsigned char' in the dtype mapping to improve future maintainability.

Suggested change
2: ['c10::half', 'c10::bfloat16'],
2: ['c10::half', 'c10::bfloat16'],
# 'unsigned char' is included as a representation for 1-byte data types, often used as a fallback or for specific low-precision formats.

Copilot uses AI. Check for mistakes.
@ajassani ajassani merged commit fd7dc4b into main May 8, 2025
@ajassani ajassani deleted the fix/te_ops_byte_missing_dtype branch May 8, 2025 19:08
lauri9 pushed a commit that referenced this pull request Jun 11, 2025
Fix missing dtype in bytes calculation when calculating output dtype
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.

4 participants