-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
feature requeststatus: needs-triageNew issue, not yet reviewed or categorizedNew issue, not yet reviewed or categorized
Description
Is this a new feature, an improvement, or a change to existing functionality?
New Feature
How would you describe the priority of this feature request?
low
Please provide a clear description of problem this feature solves
require ct.count function in some statistical method, example:
import torch
import cuda.tile as ct
@ct.function
def tile_histogram(
data: ct.Tile, bins: ct.Tile,
min: float, bin_size: float, num_bins: int
) -> ct.Tile:
data = data - min
data = ct.floor(data / bin_size)
data = ct.clip(data, 0, num_bins)
# ct.count(data, bins):
# goes through each value v in data
# interprets v as a bin index
# increments bins[v] by 1
# returns the updated bins
bins = ct.count(data, bins)
return bins
@ct.kernel
def device_histogram(
x: ct.Array, y:ct.Array, tile_size: ct.Constant,
min: float, bin_size: float, num_bins: int
):
block_idx = ct.bid(0)
loop = x.shape[0] // tile_size
bins = ct.zeros(shape=(tile_size, ), dtype=ct.int32)
for idx in range(loop):
tile = ct.load(x, (idx, ), (tile_size, 0))
bins = tile_histogram(tile, bins, min, bin_size, num_bins)
ct.atomic_add(y, (0, ), bins)Feature Description
provide a tile op: count
ct.count(data, bins):
- goes through each value v in data
- interprets v as a bin index
- increments bins[v] by 1
- returns the updated bins
by the way, ct.clip is missing too.
Describe your ideal solution
provide a tile op: count
ct.count(data, bins):
- goes through each value v in data
- interprets v as a bin index
- increments bins[v] by 1
- returns the updated bins
by the way, ct.clip is missing too.
Describe any alternatives you have considered
No response
Additional context
No response
Contributing Guidelines
- I agree to follow cuTile Python's contributing guidelines
- I have searched the open feature requests and have found no duplicates for this feature request
Metadata
Metadata
Assignees
Labels
feature requeststatus: needs-triageNew issue, not yet reviewed or categorizedNew issue, not yet reviewed or categorized