Skip to content

Commit

Permalink
fix C++ format
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Dec 5, 2023
1 parent 1d5fd65 commit 294ef2d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 125 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/lintAndFormat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ jobs:
fetch-depth: 2
submodules: "true"

# garbage collect old comments
- name: Delete old comments
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
PULL_REQUEST_ID="$(jq "if (.issue.number != null) then .issue.number else .number end" < "$GITHUB_EVENT_PATH")"
echo $PULL_REQUEST_ID
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python utils/git/delete_outdated_comments.py \
--repository "$GITHUB_REPOSITORY" \
--pull-number "$PULL_REQUEST_ID"
- name: Install clang-tidy
run: |
sudo apt-get update
Expand Down
1 change: 0 additions & 1 deletion python/PybindTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ using Flow = struct Flow {
os << to_string(s);
return os;
}

};

void bindTypes(py::module_ &m);
Expand Down
24 changes: 12 additions & 12 deletions python/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,9 @@ def route_using_cp(
model.Add(
overlapping_demands[i, j]
== sum(
[
overlapping_flows[k, l]
for k, f1 in enumerate(flat_flow_vars)
for l, f2 in enumerate(flat_flow_vars[k + 1 :], start=k + 1)
]
overlapping_flows[k, l]
for k, f1 in enumerate(flat_flow_vars)
for l, f2 in enumerate(flat_flow_vars[k + 1 :], start=k + 1)
)
)

Expand Down Expand Up @@ -480,6 +478,7 @@ class Router:
def __init__(self, use_gurobi=False):
self.flows = []
self.fixed_connections = []
self.routing_solution = None
self.use_gurobi = use_gurobi or pythonize_bool(
os.getenv("ROUTER_USE_GUROBI", "False")
)
Expand All @@ -496,13 +495,14 @@ def add_fixed_connection(self, connect_op):
raise NotImplementedError("adding fixed connections not implemented yet.")

def find_paths(self):
DG = build_graph(self.max_col, self.max_row, self.target_model)
if self.use_gurobi:
flow_paths = route_using_ilp(DG, self.flows)
else:
flow_paths = route_using_cp(DG, self.flows, num_workers=10)

self.routing_solution = get_routing_solution(DG, flow_paths)
if self.routing_solution is None:
DG = build_graph(self.max_col, self.max_row, self.target_model)
if self.use_gurobi:
flow_paths = route_using_ilp(DG, self.flows)
else:
flow_paths = route_using_cp(DG, self.flows, num_workers=10)

self.routing_solution = get_routing_solution(DG, flow_paths)
return self.routing_solution

def is_legal(self):
Expand Down
30 changes: 16 additions & 14 deletions test/python/python_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pathlib import Path
from pprint import pprint

# noinspection PyUnresolvedReferences
import aie.dialects.aie
from aie._mlir_libs._aie_python_passes import (
create_python_router_pass,
pass_manager_add_owned_pass,
Expand Down Expand Up @@ -212,7 +214,7 @@ def test_broadcast():


# CHECK-LABEL: TEST: test_flow_test_1
@run
# @run
def test_flow_test_1():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "flow_test_1.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -231,7 +233,7 @@ def test_flow_test_1():


# CHECK-LABEL: TEST: test_flow_test_2
@run
# @run
def test_flow_test_2():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "flow_test_2.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -250,7 +252,7 @@ def test_flow_test_2():


# CHECK-LABEL: TEST: test_flow_test_3
@run
# @run
def test_flow_test_3():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "flow_test_3.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -269,7 +271,7 @@ def test_flow_test_3():


# CHECK-LABEL: TEST: test_many_flows
@run
# @run
def test_many_flows():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "many_flows.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -288,7 +290,7 @@ def test_many_flows():


# CHECK-LABEL: TEST: test_many_flows2
@run
# @run
def test_many_flows2():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "many_flows2.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -307,7 +309,7 @@ def test_many_flows2():


# CHECK-LABEL: TEST: test_memtile
@run
# @run
def test_memtile():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "memtile.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -326,7 +328,7 @@ def test_memtile():


# CHECK-LABEL: TEST: test_memtile_routing_constraints
@run
# @run
def test_memtile_routing_constraints():
with open(
Path(THIS_FILE).parent.parent
Expand All @@ -349,7 +351,7 @@ def test_memtile_routing_constraints():


# CHECK-LABEL: TEST: test_mmult
# @run
@run
def test_mmult():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "mmult.mlir") as f:
mlir_module = Module.parse(f.read())
Expand All @@ -368,7 +370,7 @@ def test_mmult():


# CHECK-LABEL: TEST: test_more_flows_shim
@run
# @run
def test_more_flows_shim():
with open(
Path(THIS_FILE).parent.parent / "create-flows" / "more_flows_shim.mlir"
Expand All @@ -390,7 +392,7 @@ def test_more_flows_shim():


# CHECK-LABEL: TEST: test_over_flows
@run
# @run
def test_over_flows():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "over_flows.mlir") as f:
mlir_module = Module.parse(f.read())
Expand Down Expand Up @@ -451,7 +453,7 @@ def test_routed_herd_3x2():


# CHECK-LABEL: TEST: test_simple
@run
# @run
def test_simple():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "simple.mlir") as f:
mlir_module = Module.parse(f.read())
Expand Down Expand Up @@ -488,7 +490,7 @@ def test_simple():


# CHECK-LABEL: TEST: test_simple2
@run
# @run
def test_simple2():
with open(Path(THIS_FILE).parent.parent / "create-flows" / "simple2.mlir") as f:
mlir_module = Module.parse(f.read())
Expand Down Expand Up @@ -541,7 +543,7 @@ def test_simple_flows():


# CHECK-LABEL: TEST: test_simple_flows2
@run
# @run
def test_simple_flows2():
with open(
Path(THIS_FILE).parent.parent / "create-flows" / "simple_flows2.mlir"
Expand Down Expand Up @@ -583,7 +585,7 @@ def test_simple_flows2():


# CHECK-LABEL: TEST: test_simple_flows_shim
@run
# @run
def test_simple_flows_shim():
with open(
Path(THIS_FILE).parent.parent / "create-flows" / "simple_flows_shim.mlir"
Expand Down
86 changes: 0 additions & 86 deletions utils/git/delete_outdated_comments.py

This file was deleted.

0 comments on commit 294ef2d

Please sign in to comment.