Reference guide: Overview

General Remarks

Creation via Static Methods

To map more directly to the isl’s C interface, object creation in islpy is done through static methods instead of through constructors. These are marked ‘(static)’ in each class’s overview section.

Documented vs. Non-documented Functionality

Since islpy is automatically generated from the isl C headers, some of the functionality it exposes might be undocumented. Undocumented functionality might change or vanish without notice. ‘Documented’ functionality is defined as whatever is mentioned in the isl manual. islpy will let you call undocumented functions, but you are doing so at your own risk.

Invalidation of Arguments

You may notice that a few methods below say ‘(becomes invalid)’. This has to do with an idiosyncrasy in isl’s interface that was retained at the Python level for efficiency. Such arguments will be deleted (by isl) upon entry to the called function. If you would like to retain access to that object, simply append a .copy() to that argument. (Note that you will notice if an object got deleted for you accidentally, as the next operation on it will simply fail with an exception.)

Automatic Casts

islpy will automatically perform the following upward casts in argument lists:

as well as casts contained in the transitive closure of this ‘casting graph’.

Version Info

islpy.version
islpy.isl_version()

Error Reporting

exception islpy.Error

Convenience

islpy.make_zero_and_vars(set_vars: Sequence[str], params: Sequence[str] = (), ctx: Context | None = None) dict[str | Literal[0], PwAff]
Parameters:
  • set_vars – an iterable of variable names, or a comma-separated string

  • params – an iterable of variable names, or a comma-separated string

Returns:

a dictionary from variable names (in set_vars and params) to PwAff instances that represent each of the variables. They key ‘0’ is also include and represents a PwAff zero constant.

Added in version 2016.1.1.

This function is intended to make it relatively easy to construct sets programmatically without resorting to string manipulation.

Usage example:

v = isl.make_zero_and_vars("i,j,k", "n")

myset = (
        v[0].le_set(v["i"] + v["j"])
        &
        (v["i"] + v["j"]).lt_set(v["n"])
        &
        (v[0].le_set(v["i"]))
        &
        (v["i"].le_set(13 + v["n"]))
        )
islpy.affs_from_space(space: Space) dict[Literal[0] | str, PwAff]
Returns:

a dictionary from variable names (in set_vars and params) to PwAff instances that represent each of the variables in*space. They key ‘0’ is also include and represents a PwAff zero constant.

Added in version 2016.2.

This function is intended to make it relatively easy to construct sets programmatically without resorting to string manipulation.

Usage example:

s = isl.Set("[n] -> {[i,j,k]: 0<=i,j,k<n}")
v = isl.affs_from_space(s.space)

myset = (
        v[0].le_set(v["i"] + v["j"])
        &
        (v["i"] + v["j"]).lt_set(v["n"])
        &
        (v[0].le_set(v["i"]))
        &
        (v["i"].le_set(13 + v["n"]))
        )

Lifetime Helpers

class islpy.CallbackLifetimeHandle

Some callbacks, notably those in AstBuild, need to outlive the function call to which they’re passed. These callback return a callback handle that must be kept alive until the callback is no longer needed.

Global Data

islpy.DEFAULT_CONTEXT

ISL objects being unpickled or initialized from strings will be instantiated within this Context.

Added in version 2015.2.

Symbolic Constants

class islpy.error(*values)
abort = 1
alloc = 2
internal = 4
invalid = 5
none = 0
quota = 6
unknown = 3
unsupported = 7
class islpy.dim_type(*values)
all = 5
cst = 0
div = 4
in_ = 2
out = 3
param = 1
set = 3
class islpy.fold(*values)
list = 2
max = 1
min = 0
class islpy.format
C = 4
EXT_POLYLIB = 6
ISL = 0
LATEX = 5
OMEGA = 3
POLYLIB = 1
POLYLIB_CONSTRAINTS = 2
class islpy.yaml_style
BLOCK = 0
FLOW = 1

Output

class islpy.Printer
__eq__(value, /)

Return self==value.

__hash__()

Return hash(self).

__ne__(value, /)

Return self!=value.

ast_op_type_set_print_name(self, type: ast_expr_op_type, name: str) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

end_line(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

flush(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

get_ctx(self) Context

Warning

This function is not part of the officially public isl API. Use at your own risk.

get_note(self, id: Id) Id

Warning

This function is not part of the officially public isl API. Use at your own risk.

get_output_format(self) int

Warning

This function is not part of the officially public isl API. Use at your own risk.

get_str(self) str

Warning

This function is not part of the officially public isl API. Use at your own risk.

get_yaml_style(self) int

Warning

This function is not part of the officially public isl API. Use at your own risk.

has_note(self, id: Id) bool

Warning

This function is not part of the officially public isl API. Use at your own risk.

indent(self, indent: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_aff(self, aff: Aff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_aff_list(self, list: AffList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_ast_expr(self, expr: AstExpr) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_ast_expr_list(self, list: AstExprList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_ast_node(self, node: AstNode) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_ast_node_list(self, list: AstNodeList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_basic_map(self, bmap: BasicMap) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_basic_map_list(self, list: BasicMapList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_basic_set(self, bset: BasicSet) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_basic_set_list(self, list: BasicSetList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_constraint(self, c: Constraint) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_constraint_list(self, list: ConstraintList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_double(self, d: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_id(self, id: Id) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_id_list(self, list: IdList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_int(self, i: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_local_space(self, ls: LocalSpace | Space) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_map(self, map: Map | BasicMap) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_map_list(self, list: MapList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_multi_aff(self, maff: MultiAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_multi_id(self, mi: MultiId) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_multi_pw_aff(self, mpa: MultiPwAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_multi_union_pw_aff(self, mupa: MultiUnionPwAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_multi_val(self, mv: MultiVal) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_point(self, pnt: Point) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_aff(self, pwaff: PwAff | Aff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_aff_list(self, list: PwAffList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_multi_aff(self, pma: PwMultiAff | MultiAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_multi_aff_list(self, list: PwMultiAffList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_qpolynomial(self, pwqp: PwQPolynomial) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_qpolynomial_fold(self, pwf: PwQPolynomialFold) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_qpolynomial_fold_list(self, list: PwQPolynomialFoldList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_pw_qpolynomial_list(self, list: PwQPolynomialList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_qpolynomial(self, qp: QPolynomial) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_qpolynomial_fold(self, fold: QPolynomialFold) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_qpolynomial_list(self, list: QPolynomialList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_schedule(self, schedule: Schedule) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_schedule_constraints(self, sc: ScheduleConstraints) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_schedule_node(self, node: ScheduleNode) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_set(self, map: Set | BasicSet) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_set_list(self, list: SetList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_space(self, space: Space) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_str(self, s: str) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_access_info(self, access: UnionAccessInfo) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_flow(self, flow: UnionFlow) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_map(self, umap: UnionMap | BasicMap | Map) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_map_list(self, list: UnionMapList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_aff(self, upa: UnionPwAff | Aff | PwAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_aff_list(self, list: UnionPwAffList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_multi_aff(self, upma: UnionPwMultiAff | MultiAff | PwMultiAff) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_multi_aff_list(self, list: UnionPwMultiAffList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_qpolynomial(self, upwqp: UnionPwQPolynomial) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_pw_qpolynomial_fold(self, upwf: UnionPwQPolynomialFold) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_set(self, uset: UnionSet | BasicSet | Set) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_union_set_list(self, list: UnionSetList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_val(self, v: Val | int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_val_list(self, list: ValList) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

print_vec(self, vec: Vec) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_indent(self, indent: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_indent_prefix(self, prefix: str) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_isl_int_width(self, width: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_note(self, id: Id, note: Id) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_output_format(self, output_format: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_prefix(self, prefix: str) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_suffix(self, suffix: str) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

set_yaml_style(self, yaml_style: int) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

start_line(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

to_str = <nanobind.nb_func object>
yaml_end_mapping(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

yaml_end_sequence(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

yaml_next(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

yaml_start_mapping(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

yaml_start_sequence(self) Self
..note::

{arg.name} is mutated in-place.

..note::

Returns self.

Warning

This function is not part of the officially public isl API. Use at your own risk.

Helper functions

class islpy.AlignableT

alias of TypeVar(‘AlignableT’, bound=Space | Set | Map | BasicSet | BasicMap | Aff | PwAff)

class islpy.AlignableT2

alias of TypeVar(‘AlignableT2’, bound=Space | Set | Map | BasicSet | BasicMap | Aff | PwAff)

islpy.align_spaces(obj: AlignableT, template: Space | Set | Map | BasicSet | BasicMap | Aff | PwAff, obj_bigger_ok: bool = False) AlignableT

Try to make the space in which obj lives the same as that of template by adding/matching named dimensions.

Parameters:

obj_bigger_ok – If True, no error is raised if the resulting obj has more dimensions than template.

islpy.align_two(obj1: AlignableT, obj2: AlignableT2) tuple[AlignableT, AlignableT2]

Align the spaces of two objects, potentially modifying both of them.

See also align_spaces().

Canonical Names for Internal Module

class islpy._isl.stat

A status result.

class islpy._isl.error

See islpy.error.

class islpy._isl.dim_type

See islpy.dim_type.

class islpy._isl.fold

See islpy.fold.

class islpy._isl.format

See islpy.format.

class islpy._isl.yaml_style

See islpy.yaml_style.

class islpy._isl.Printer

See islpy.Printer.

class islpy._monkeypatch.SetLikeT

A type variable with an upper bound of islpy.BasicSet | islpy.Set.

class islpy._monkeypatch.AffOrConstraintT

A type variable with an upper bound of islpy.Aff | islpy.Constraint.

class islpy._monkeypatch.BasicT

A type variable with an upper bound of islpy.BasicSet | islpy.BasicMap.

class islpy._monkeypatch.SetOrMapT

A type variable with comprising islpy.BasicSet | islpy.Set | islpy.BasicMap | islpy.Map.