Skip to content

Commit

Permalink
1. Adding floating point capabilities to reduce block. 2. Fix for gen…
Browse files Browse the repository at this point in the history
…erate matrix BF16 compressed mode
  • Loading branch information
samidhm committed Feb 29, 2024
1 parent ce5ba84 commit d1ed8f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 6 additions & 3 deletions sam/onyx/generate_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,13 @@ def dump_outputs(self, format=None, tpose=False, dump_shape=True,
flat_array.append(val)
if glb_override:
lines = [len(flat_array), *flat_array]
self.write_array(lines, name=f"tensor_{self.name}_mode_vals{suffix}", dump_dir=use_dir, dump_hex=print_hex)
self.write_array(lines, name=f"tensor_{self.name}_mode_vals{suffix}",
dump_dir=use_dir, dump_hex=print_hex, is_val=True)
else:
self.write_array(flat_array, name=f"tensor_{self.name}_mode_vals{suffix}", dump_dir=use_dir,
dump_hex=print_hex)
self.write_array(flat_array, name=f"tensor_{self.name}_mode_vals{suffix}",
dump_dir=use_dir, dump_hex=print_hex, is_val=True)


elif self.format == "COO":
crd_dict = dict()
order = len(self.array.shape)
Expand Down
11 changes: 10 additions & 1 deletion sam/onyx/hw_nodes/reduce_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,16 @@ def configure(self, attributes):
# TODO: make this use the metamapper
instr_type = strip_modifiers(lassen_fc.Py.input_t.field_dict['inst'])
asm_ = Assembler(instr_type)
op = int(asm_.assemble(asm.add()))

if 'fp' in attributes:
is_fp = attributes['fp'].strip('"')
if (is_fp == 'true'):
op = int(asm_.assemble(asm.fp_add()))
else:
op = int(asm_.assemble(asm.add()))
else:
op = int(asm_.assemble(asm.add()))

cfg_kwargs = {
'stop_lvl': stop_lvl,
'pe_connected_to_reduce': pe_connected_to_reduce,
Expand Down

0 comments on commit d1ed8f7

Please sign in to comment.