Skip to content
Snippets Groups Projects
Commit 00872d1d authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Change label syntax. Add syntax for forced iname deps.

parent a1a552c4
No related branches found
No related tags found
No related merge requests found
......@@ -37,26 +37,30 @@ TODO: variable shuffle detection
Things to consider
^^^^^^^^^^^^^^^^^^
- implemented_domain may end up being smaller than requested in cse
evaluations--check that!
- Depedencies are pointwise for shared loop dimensions
and global over non-shared ones (between dependent and ancestor)
- multiple insns could fight over which iname gets local axis 0
-> complicated optimization problem
- Every loop in loopy is opened at most once.
Too restrictive?
- Loop bounds currently may not depend on parallel dimensions
Does it make sense to relax this?
TODO
^^^^
- implemented_domain may end up being smaller than requested in cse
evaluations--check that!
- Parallel dimension splitting/merging via tags
- FIXME: Deal with insns losing a seq iname dep in a CSE realization
a <- cse(reduce(stuff))
- Every loop in loopy is opened at most once.
- reimplement add_prefetch
- user interface for dim length prescription
......@@ -71,13 +75,17 @@ TODO
- Sharing of checks across ILP instances
- Loop bounds currently may not depend on parallel dimensions
Does it make sense to relax this?
- Some things involving CSEs might be impossible to schedule
a[i,j] = cse(b[i]) * cse(c[j])
- Flag, exploit idempotence
Dealt with
^^^^^^^^^^
- make syntax for explicit loop dependencies
- Make syntax for iname dependencies
- make syntax for insn dependencies
- Implement get_problems()
......
......@@ -404,15 +404,17 @@ class LoopKernel(Record):
"""
import re
LABEL_DEP_RE = re.compile(
r"^(?:\{(?P<label>\w+)\})?"
r"^\s*(?:(?P<label>\w+):)?"
"\s*(?:\[(?P<iname_deps>[\s\w,]+)\])?"
"\s*(?P<lhs>.+)\s*=\s*(?P<rhs>.+?)\s*?"
"(?:\:\s*(?P<deps>[\s\w,]+))?$"
"(?:\:\s*(?P<insn_deps>[\s\w,]+))?$"
)
def parse_if_necessary(insn):
from pymbolic import parse
deps = []
insn_deps = []
forced_iname_deps = []
label = "insn"
if isinstance(insn, Instruction):
......@@ -425,8 +427,10 @@ class LoopKernel(Record):
groups = label_dep_match.groupdict()
if groups["label"] is not None:
label = groups["label"]
if groups["deps"] is not None:
deps = [dep.strip() for dep in groups["deps"].split(",")]
if groups["insn_deps"] is not None:
insn_deps = [dep.strip() for dep in groups["insn_deps"].split(",")]
if groups["iname_deps"] is not None:
forced_iname_deps = [dep.strip() for dep in groups["iname_deps"].split(",")]
lhs = parse(groups["lhs"])
from loopy.symbolic import FunctionToPrimitiveMapper
......@@ -434,7 +438,8 @@ class LoopKernel(Record):
return Instruction(
id=self.make_unique_instruction_id(insns, based_on=label),
insn_deps=deps,
insn_deps=insn_deps,
forced_iname_deps=forced_iname_deps,
assignee=lhs, expression=rhs)
if isinstance(domain, str):
......
......@@ -203,7 +203,7 @@ def test_plain_matrix_mul_new_ui(ctx_factory):
knl = lp.LoopKernel(ctx.devices[0],
"[n] -> {[i,j,k]: 0<=i,j,k<n}",
[
"{label} c[i, j] = sum_float32(k, cse(a[i, k], lhsmat)*cse(b[k, j], rhsmat))"
"label: c[i, j] = sum_float32(k, cse(a[i, k], lhsmat)*cse(b[k, j], rhsmat))"
],
[
lp.ArrayArg("a", dtype, shape=(n, n), order=order),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment