Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cre/fact.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def _standardize_conversions(conversions, attr_type, context):
stand_conv = {}
for conv_type, conv_op in conversions.items():
conv_type = _standardize_type(conv_type, context)
print(attr_type)
# print(attr_type)
if(isinstance(conv_op, UntypedCREFunc)): conv_op = conv_op(attr_type)
assert conv_op.return_type == conv_type, f"{conv_op} does not return conversion type {conv_type}."
stand_conv[conv_type] = conv_op
Expand Down
2 changes: 1 addition & 1 deletion cre/memset.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def ctor():
'''
source_to_cache('MemSetIndexer', long_hash, source)
ctor = import_from_cached('MemSetIndexer', long_hash, ['ctor'])['ctor']
print(ctor)
# print(ctor)
_indexer_ctor_impls[tup] = ctor
return _indexer_ctor_impls[tup]

Expand Down
17 changes: 14 additions & 3 deletions cre/transform/memset_builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from numba.typed import List
from cre.context import cre_context
from cre.memset import MemSet

Expand Down Expand Up @@ -43,9 +44,19 @@ def tranform(self, state_dict, out_memset=None, return_map=False):
if(attr not in config): continue
val_name = config[attr]
if(not val_name): continue # i.e. skip if None or empty str
if(val_name not in fact_instances):
raise ValueError(f"Reference to unspecified fact {val_name}.")
setattr(fact, attr, fact_instances[val_name])

if isinstance(val_name, list):
fact_list = []
for elem_val_name in val_name:
if(not elem_val_name): continue # i.e. skip if None or empty str
if(elem_val_name not in fact_instances):
raise ValueError(f"Reference to unspecified fact {elem_val_name} in {val_name}.")
fact_list.append(fact_instances[elem_val_name])
setattr(fact, attr, List(fact_list))
else:
if(val_name not in fact_instances):
raise ValueError(f"Reference to unspecified fact {val_name}.")
setattr(fact, attr, fact_instances[val_name])

# Declare each fact to a new MemSet
if(out_memset is None):
Expand Down