Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some comments in codegen #41

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.3.0]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
25 changes: 25 additions & 0 deletions .github/workflows/juliapackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit test

on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.0', '1.1', '1.2', '1.3', 'nightly']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/[email protected]
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}

- name: "Unit Test"
uses: julia-actions/julia-runtest@master
3 changes: 3 additions & 0 deletions src/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ function augment_impl(var_offset::Int, op_offset::Int, head::DataType, tail::NTu
num_affine, after_affine = uses_affinemap(head, tail) ? seek_connected(uses_affinemap, 0, head, tail) : (0, nothing)
num_special, _ = seek_connected(x->(supports_permute(x)||supports_view(x)||supports_stepview(x)), 0, head, tail)
num_lazy, after_lazy = seek_connected(supports_lazy, 0, head, tail)
@assert num_special <= num_affine <= num_lazy # issue #40
if num_special >= num_affine
Copy link
Collaborator Author

@johnnychen94 johnnychen94 Jan 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A subtlety here:

Suggested change
if num_special >= num_affine
if num_special > num_affine

Here's the reasoning behind: when num_special == num_affine, according to #40, all special operations support affinemap, hence they can be unrolled using unroll_applyaffine

Tests and benchmarks are required to verify this change. If luckily we can get a performance boost here. At present, I can't make any promise.

# If reached then there're non-affine special operations
quote
$var_out = unroll_applylazy($(Expr(:tuple, (:(pipeline[$i]) for i in op_offset:op_offset+num_lazy-1)...)), $var_in)
$(augment_impl(var_offset+1, op_offset+num_lazy, after_lazy, avoid_eager))
end
else
# If reached then all special operations are affine operations
quote
$var_out = unroll_applyaffine($(Expr(:tuple, (:(pipeline[$i]) for i in op_offset:op_offset+num_affine-1)...)), $var_in)
$(augment_impl(var_offset+1, op_offset+num_affine, after_affine, avoid_eager))
Expand Down