Skip to content

add ops - #1235

Closed
adamasWHM wants to merge 1 commit into
flagos-ai:masterfrom
adamasWHM:add_ops
Closed

add ops #1235
adamasWHM wants to merge 1 commit into
flagos-ai:masterfrom
adamasWHM:add_ops

Conversation

@adamasWHM

Copy link
Copy Markdown

modify

PR Category

Type of Change

Description

Issue

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

modify
@CLAassistant

CLAassistant commented Dec 18, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

import triton.language as tl

from flag_gems.utils import pointwise_dynamic, tl_extra_shim
from ..utils.pointwise_dynamic import pointwise_dynamic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we do the following instead?
import from relative path is not a good practice IMHO.

from flag_gems.utils import pointwise_dynamic


import triton

from ..utils.pointwise_dynamic import pointwise_dynamic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same suggestion as above.

return ~x

def bitwise_not(A):
print("ASCEND GEMS BITWISE NOT")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe we should avoid ALL print calls in this level of source code.

return bitwise_not_func(A)

def bitwise_not_(A):
print("ASCEND GEMS BITWISE NOT_")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here.

raise ValueError(
"No type promotion method provided! You must provide type promotion method for each output!"
)
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this else: is not needed ...

canonicalized.append(
(*arg_indices, ELEMENTWISE_TYPE_PROMOTION_KIND[method])
)
return canonicalized

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

# Slower: explicit append call in a loop
new_list = []
for item in old_list:
    if condition(item):
        new_list.append(item)

# Faster: list comprehension
new_list = [item for item in old_list if condition(item)]

input_types = []
for is_tensor, dtype in zip(self._is_tensor, self._dtypes):
if is_tensor:
input_types.append("StridedBuffer")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if we can optimize this by giving "StridedBuffer" a shorter name.

return self.signature(outputs_in_arg=False)

class KernelGenerator:
def init(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this method be __init__ ?

"""
)
# code.writeline("],")
# code.writeline("key=['num_tasks'],")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pls remove line 244, 257, 258

code.writeline("num_tasks: int,")

# tile size & tiles_per_cta, gsl style
if ndim > 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this check again?

@bin913

bin913 commented May 13, 2026

Copy link
Copy Markdown
Collaborator

@adamasWHM Do you still keep track of this PR?

@bin913
bin913 self-requested a review May 13, 2026 11:53
@bin913 bin913 closed this May 18, 2026
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