Warning

You are reading a version of the website built against the unstable main branch. This content is liable to change without notice and may be inappropriate for your use case. You can find the documentation for the current stable release here.

pyop3.compile package

Submodules

pyop3.compile.context module

class pyop3.compile.context.CodegenContext(*, named_terminal_buffer_intents, propagate_negatives, mask_array_accesses)[source]

Bases: ABC

Base class for code generation backends

Class designed solely for use in codegen.py, as an interface to specific backends.

abstractmethod add_assignment(assignee, expression, prefix='insn')[source]
abstractmethod add_buffer(buffer_view, intent=None)[source]
abstractmethod add_domain(iname, *args)[source]
abstractmethod add_function_call(assignees, expression, prefix='insn')[source]
abstractmethod add_leaf_assignment(assignee, expression, assignment_type, paths, iname_maps, loop_indices)[source]
add_subkernel(subkernel)[source]
property arguments
property domains
property instructions
abstractmethod lower_buffer_access(buffer, layouts, iname_maps, loop_indices, *, intent)[source]

Determine indexing and lower buffer expression to respective IR

abstractmethod lower_expr(expr, iname_maps, loop_indices, intent=None, paths=None)[source]

Lower a PyOP3 expression to the target’s IR representation.

Returns:

  • pymbolic for Loopy

  • xDSL for MLIR

abstractmethod register_extent(obj, inames, loop_indices)[source]
abstractmethod set_temporary_shapes(shapes)[source]
property subkernels
unique_name(prefix)[source]
abstractmethod var(iname, *args)[source]

Implementation to represent symbolic variable for respective IR

pyop3.compile.core module

pyop3.compile.core.parse_assignment(assignment, loop_indices, codegen_context)[source]

pyop3.compile.loopy module

class pyop3.compile.loopy.INVCallable(name=None, arg_id_to_dtype=None, arg_id_to_descr=None, name_in_target=None)[source]

Bases: LACallable

The InverseCallable replaces loopy.CallInstructions to “inverse” functions by LAPACK getri.

generate_preambles(target)[source]
name = 'inverse'
class pyop3.compile.loopy.LACallable(name=None, arg_id_to_dtype=None, arg_id_to_descr=None, name_in_target=None)[source]

Bases: ScalarCallable

The LACallable (Linear algebra callable) replaces loopy.CallInstructions to linear algebra functions like solve or inverse by LAPACK calls.

emit_call_insn(insn, target, expression_to_code_mapper)[source]
abstractmethod generate_preambles(target)[source]
abstract property name
with_types(arg_id_to_dtype, callables_table)[source]
class pyop3.compile.loopy.LoopyCodegenContext(**kwargs)[source]

Bases: CodegenContext

add_assignment(assignee, expression, prefix='insn')[source]
add_buffer(buffer_view, intent=None)[source]
add_cinstruction(insn_str, read_variables=frozenset({}))[source]
add_domain(iname, *args)[source]
add_function_call(code, args, prefix='insn')[source]
add_leaf_assignment(assignee, expression, assignment_type, paths, iname_replace_maps, loop_indices)[source]
add_opaque(opaque, intent)[source]
add_subkernel(subkernel)[source]
add_temporary(prefix='t', dtype=dtype('int32'), *, shape=(), initializer=None, read_only=False)[source]
property arguments
property domains
finalize_kernel(function_name, compiler_parameters)[source]
property instructions
lower_buffer_access(buffer_view, layouts, iname_maps, loop_indices, *, intent)[source]
lower_expr(expr, iname_maps, loop_indices, *, intent=Intent.READ, paths=None)[source]
maybe_multiindex(buffer, offset_expr)[source]
register_extent(obj, *args, **kwargs)[source]
register_extent(num, *args, **kwargs)
register_extent(expr, inames, loop_indices)
set_temporary_shapes(shapes)[source]
property subkernels
var(iname, *args)[source]
within_inames(inames)[source]
class pyop3.compile.loopy.SolveCallable(name=None, arg_id_to_dtype=None, arg_id_to_descr=None, name_in_target=None)[source]

Bases: LACallable

The SolveCallable replaces loopy.CallInstructions to “solve” functions by LAPACK getrs.

generate_preambles(target)[source]
name = 'solve'

pyop3.compile.transform module

pyop3.compile.transform.with_attach_debugger(kernel)[source]
pyop3.compile.transform.with_likwid_markers(knl)[source]

See https://github.com/RRZE-HPC/likwid/wiki/TutorialMarkerC

pyop3.compile.transform.with_petsc_event(knl)[source]

Module contents