Skip to content

Commit

Permalink
Add type to isinstance call (#287)
Browse files Browse the repository at this point in the history
Add type to isinstance call _create_subcompilers to fix issue where
  • Loading branch information
mgkwill committed Jul 29, 2022
1 parent 1700dec commit 0a608fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lava/magma/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,18 @@ def _create_subcompilers(
# ...and add it to the list.
subcompilers.append(compiler)
# Remember the index for C and Nc subcompilers:
if isinstance(compiler, CProcCompiler):
if isinstance(compiler, type(CProcCompiler)):
c_idx.append(idx)
if isinstance(compiler, NcProcCompiler):
if isinstance(compiler, type(NcProcCompiler)):
nc_idx.append(idx)

# Implement the heuristic "C-first Nc-second" whenever C and Nc
# compilers are in the list. The subcompiler.compile is called in
# their order of appearance in this list.
# ToDo: In the implementation below, we assume that there is only one
# instance of each subcompiler (Py/C/Nc) per ProcGroup. This should
# be true as long as the `compiler_type_to_procs` mapping comes from
# `self._map_subcompiler_type_to_procs`.
# In the implementation below, we assume that there is only one
# instance of each subcompiler (Py/C/Nc) per ProcGroup. This should
# be true as long as the `compiler_type_to_procs` mapping comes from
# `self._map_subcompiler_type_to_procs`.
# 1. Confirm that there is only one instance of C and Nc subcompilers
if len(c_idx) > 1 or len(nc_idx) > 1:
raise AssertionError("More than one instance of C or Nc "
Expand Down

0 comments on commit 0a608fa

Please sign in to comment.