Skip to content

Patch2 #6

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

Merged
merged 12 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions .buildkite/0_webui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ steps:

# Our signed pipelines must have a `signature` or `signature_file` parameter that
# verifies the treehash of the pipeline itself and the inputs listed in `inputs`
signed_pipelines:
- pipeline: .buildkite/signed_pipeline_test.yml
signature: "U2FsdGVkX18aZgryp6AJTArgD2uOnVWyFFGVOP5qsY4WbGQ/LVAcYiMEp9cweV+2iht+vmEF949CuuGTeQPA1fKlhPwkG3nZ688752DUB6en9oM2nuL31NoDKWHhpygZ"
#signed_pipelines:
# - pipeline: .buildkite/signed_pipeline_test.yml
# signature: "U2FsdGVkX18aZgryp6AJTArgD2uOnVWyFFGVOP5qsY4WbGQ/LVAcYiMEp9cweV+2iht+vmEF949CuuGTeQPA1fKlhPwkG3nZ688752DUB6en9oM2nuL31NoDKWHhpygZ"
37 changes: 37 additions & 0 deletions .buildkite/embedding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# These steps should only run on `sandbox.jl` machines, not `docker`-isolated ones
# since we need nestable sandboxing. The rootfs images being used here are built from
# the `.buildkite/rootfs_images/llvm-passes.jl` file.
agents:
queue: "julia"
# Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing
sandbox.jl: "true"
os: "linux"

steps:
- label: "Run embedding tests"
key: embedding
plugins:
- JuliaCI/julia#v1:
version: 1.6
- staticfloat/sandbox#v1:
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
uid: 1000
gid: 1000
workspaces:
# Include `/cache/repos` so that our `git` version introspection works.
- "/cache/repos:/cache/repos"
commands: |
prefix="/tmp/prefix"
echo "+++ Build julia, deploy to $${prefix}"
make -j$${JULIA_NUM_CORES} JULIA_PRECOMPILE=0 prefix=$${prefix} install

embedding_output="/tmp/embedding-test"
echo "+++ Run embedding tests, deploy to $${embedding_output}"
mkdir -p "$${embedding_output}"
make -j$${JULIA_NUM_CORES} -C test/embedding JULIA="$${prefix}/bin/julia" BIN="$${embedding_output}"

timeout_in_minutes: 60
notify:
- github_commit_status:
context: "embedding"
29 changes: 22 additions & 7 deletions .buildkite/llvm_passes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,29 @@ agents:

steps:
- label: "analyzegc"
key: analyzegc
plugins:
- JuliaCI/julia#v1:
version: 1.6
- staticfloat/sandbox#v1:
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
workspaces:
# Include `/cache/repos` so that our `git` version introspection works.
- "/cache/repos:/cache/repos"
commands: |
echo "--- Install in-tree LLVM dependencies"
make -j 6 -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind
make -j$${JULIA_NUM_CORES} -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind
echo "+++ run clangsa/analyzegc"
make -j 6 -C test/clangsa
make -j 6 -C src analyzegc
make -j$${JULIA_NUM_CORES} -C test/clangsa
make -j$${JULIA_NUM_CORES} -C src analyzegc
timeout_in_minutes: 60
notify:
- github_commit_status:
context: "analyzegc"

- label: "llvmpasses"
key: llvmpasses
plugins:
- JuliaCI/julia#v1:
version: 1.6
Expand All @@ -32,9 +40,16 @@ steps:
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
uid: 1000
gid: 1000
workspaces:
- "/cache/repos:/cache/repos"
commands: |
echo "+++ run llvmpasses"
make -j 6 release
make -j 6 -C src install-analysis-deps
make -j 6 -C test/llvmpasses
echo "--- make release"
make -j$${JULIA_NUM_CORES} release JULIA_PRECOMPILE=0
echo "--- make src/install-analysis-deps"
make -j$${JULIA_NUM_CORES} -C src install-analysis-deps
echo "+++ make test/llvmpasses"
make -j$${JULIA_NUM_CORES} -C test/llvmpasses
timeout_in_minutes: 60
notify:
- github_commit_status:
context: "llvm passes"
2 changes: 2 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
steps:
- label: ":buildkite: Launch unsigned pipelines"
commands: |
buildkite-agent pipeline upload .buildkite/whitespace.yml
buildkite-agent pipeline upload .buildkite/llvm_passes.yml
buildkite-agent pipeline upload .buildkite/embedding.yml
agents:
queue: julia
26 changes: 26 additions & 0 deletions .buildkite/whitespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# These steps should only run on `sandbox.jl` machines, not `docker`-isolated ones
# since we need nestable sandboxing. The rootfs images being used here are built from
# the `.buildkite/rootfs_images/llvm-passes.jl` file.
agents:
queue: "julia"
# Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing
sandbox.jl: "true"
os: "linux"

steps:
- label: "Check whitespace"
key: whitespace
plugins:
- JuliaCI/julia#v1:
version: 1.6
- staticfloat/sandbox#v1:
rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v1/llvm-passes.tar.gz
rootfs_treehash: "f3ed53f159e8f13edfba8b20ebdb8ece73c1b8a8"
workspaces:
- "/cache/repos:/cache/repos"
commands: |
make -j$${JULIA_NUM_CORES} check-whitespace
timeout_in_minutes: 10
notify:
- github_commit_status:
context: "whitespace"
6 changes: 4 additions & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ reinterpret(::Type{T}, x) where {T} = bitcast(T, x)
sizeof(obj)

Size, in bytes, of the canonical binary representation of the given `DataType` `T`, if any.
Size, in bytes, of object `obj` if it is not `DataType`.
Or the size, in bytes, of object `obj` if it is not a `DataType`.

See also [`summarysize`](@ref).

# Examples
```jldoctest
Expand All @@ -460,7 +462,7 @@ julia> sizeof(ComplexF64)
julia> sizeof(1.0)
8

julia> sizeof([1.0:10.0;])
julia> sizeof(collect(1.0:10.0))
80
```

Expand Down
46 changes: 23 additions & 23 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1103,48 +1103,48 @@ copyto!(::AbstractArray, ::CartesianIndices, ::AbstractArray, ::CartesianIndices
# Cartesian to Linear unaliased copy
function _unaliased_copyto!(::IndexLinear, dest::AbstractArray, ::IndexCartesian, src::AbstractArray)
@_inline_meta
axs = axes(src)
ax, iter = axs[1], CartesianIndices(tail(axs))
len, j = length(ax), firstindex(dest)
ax = axes1(src)
iter = CartesianIndices(safe_tail(axes(src)))
j = firstindex(dest) - 1
@inbounds for I in iter
n = 0
while n < len
dest[j + n] = src[first(ax) + n, I.I...]
n += 1
for i in ax
dest[j += 1] = src[i, I]
end
j += len
end
end

# Linear to Cartesian unaliased copy
function _unaliased_copyto!(::IndexCartesian, dest::AbstractArray, ::IndexLinear, src::AbstractArray)
@_inline_meta
axs = axes(dest)
ax, iter = axs[1], CartesianIndices(tail(axs))
len, i = length(ax), firstindex(src)
final = lastindex(src) + 1
ax = axes1(dest)
iter = CartesianIndices(safe_tail(axes(dest)))
len = length(ax)
i, final = firstindex(src) - 1, lastindex(src)
@inbounds for I in iter
len′ = min(final - i, len)
n = 0
while n < len′
dest[first(ax) + n, I.I...] = src[i + n]
n += 1
if final - i > len
for j in ax
dest[j, I] = src[i += 1]
end
else
j = first(ax) - 1
while i < final
dest[j += 1, I] = src[i += 1]
end
break
end
(i += len′) == final && break
end
end

# Cartesian to Cartesian unaliased copy
function _unaliased_copyto!(::IndexCartesian, dest::AbstractArray, ::IndexCartesian, src::AbstractArray)
@_inline_meta
axdest, axsrc = axes(dest), axes(src)
if axdest == axsrc
if axdest == axsrc
# shared iterator (manually expended)
ax, iter = axsrc[1], CartesianIndices(tail(axsrc))
ax = axes1(dest)
iter = CartesianIndices(safe_tail(axdest))
@inbounds for I in iter
for i in ax
I′ = CartesianIndex(i, I.I...)
dest[I′] = src[I′]
dest[i, I] = src[i, I]
end
end
else
Expand Down
14 changes: 14 additions & 0 deletions base/summarysize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ Compute the amount of memory, in bytes, used by all unique objects reachable fro
- `exclude`: specifies the types of objects to exclude from the traversal.
- `chargeall`: specifies the types of objects to always charge the size of all of their
fields, even if those fields would normally be excluded.

See also [`sizeof`](@ref).

# Examples
```jldoctest
julia> Base.summarysize(1.0)
8

julia> Base.summarysize(Ref(rand(100)))
848

julia> sizeof(Ref(rand(100)))
8
```
"""
function summarysize(obj;
exclude = Union{DataType, Core.TypeName, Core.MethodInstance},
Expand Down
2 changes: 2 additions & 0 deletions contrib/check-whitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ if git --no-pager grep --color -n --full-name -e ' $' -- $file_patterns; then
echo "and then a forced push of the correct branch"
exit 1
fi

echo "Whitespace check found no issues"
4 changes: 2 additions & 2 deletions deps/openblas.mk
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-exshift.patch-applied: $(BUILDDIR)/$(OP
patch -p1 -f < $(SRCDIR)/patches/openblas-exshift.patch
echo 1 > $@

$(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-filter-out-mavx-flag-on-zgemm-kernels.patch-applied: $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-openblas-exshift.patch-applied
$(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-filter-out-mavx-flag-on-zgemm-kernels.patch-applied: $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-exshift.patch-applied
cd $(BUILDDIR)/$(OPENBLAS_SRC_DIR) && \
patch -p1 -f < $(SRCDIR)/patches/openblas-filter-out-mavx-flag-on-zgemm-kernels.patch
echo 1 > $@

$(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-Only-filter-out-mavx-on-Sandybridge.patch-applied: $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-filter-out-mavx-flag-on-zgemm-kernels.patch
$(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-Only-filter-out-mavx-on-Sandybridge.patch-applied: $(BUILDDIR)/$(OPENBLAS_SRC_DIR)/openblas-filter-out-mavx-flag-on-zgemm-kernels.patch-applied
cd $(BUILDDIR)/$(OPENBLAS_SRC_DIR) && \
patch -p1 -f < $(SRCDIR)/patches/openblas-Only-filter-out-mavx-on-Sandybridge.patch
echo 1 > $@
Expand Down
23 changes: 14 additions & 9 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ static void allocate_gc_frame(jl_codectx_t &ctx, BasicBlock *b0);
static Value *get_current_task(jl_codectx_t &ctx);
static Value *get_current_ptls(jl_codectx_t &ctx);
static Value *get_current_signal_page(jl_codectx_t &ctx);
static void CreateTrap(IRBuilder<> &irbuilder);
static void CreateTrap(IRBuilder<> &irbuilder, bool create_new_block = true);
static CallInst *emit_jlcall(jl_codectx_t &ctx, Function *theFptr, Value *theF,
jl_cgval_t *args, size_t nargs, CallingConv::ID cc);
static CallInst *emit_jlcall(jl_codectx_t &ctx, JuliaFunction *theFptr, Value *theF,
Expand Down Expand Up @@ -1456,16 +1456,21 @@ static Constant *undef_value_for_type(Type *T) {
return undef;
}

static void CreateTrap(IRBuilder<> &irbuilder)
static void CreateTrap(IRBuilder<> &irbuilder, bool create_new_block)
{
Function *f = irbuilder.GetInsertBlock()->getParent();
Function *trap_func = Intrinsic::getDeclaration(
f->getParent(),
Intrinsic::trap);
irbuilder.CreateCall(trap_func);
irbuilder.CreateUnreachable();
BasicBlock *newBB = BasicBlock::Create(irbuilder.getContext(), "after_noret", f);
irbuilder.SetInsertPoint(newBB);
if (create_new_block) {
BasicBlock *newBB = BasicBlock::Create(irbuilder.getContext(), "after_noret", f);
irbuilder.SetInsertPoint(newBB);
}
else {
irbuilder.ClearInsertionPoint();
}
}

#if 0 // this code is likely useful, but currently unused
Expand Down Expand Up @@ -6901,8 +6906,8 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
if (seq_next >= 0 && (unsigned)seq_next < stmtslen) {
workstack.push_back(seq_next);
}
else if (!ctx.builder.GetInsertBlock()->getTerminator()) {
ctx.builder.CreateUnreachable();
else if (ctx.builder.GetInsertBlock() && !ctx.builder.GetInsertBlock()->getTerminator()) {
CreateTrap(ctx.builder, false);
}
while (!workstack.empty()) {
int item = workstack.back();
Expand All @@ -6912,7 +6917,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
cursor = item;
return;
}
if (seq_next != -1 && !ctx.builder.GetInsertBlock()->getTerminator()) {
if (seq_next != -1 && ctx.builder.GetInsertBlock() && !ctx.builder.GetInsertBlock()->getTerminator()) {
come_from_bb[cursor + 1] = ctx.builder.GetInsertBlock();
ctx.builder.CreateBr(nextbb->second);
}
Expand Down Expand Up @@ -7050,7 +7055,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
if (jl_is_returnnode(stmt)) {
jl_value_t *retexpr = jl_returnnode_value(stmt);
if (retexpr == NULL) {
ctx.builder.CreateUnreachable();
CreateTrap(ctx.builder, false);
find_next_stmt(-1);
continue;
}
Expand All @@ -7059,7 +7064,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
jl_cgval_t retvalinfo = emit_expr(ctx, retexpr);
retvalinfo = convert_julia_type(ctx, retvalinfo, jlrettype);
if (retvalinfo.typ == jl_bottom_type) {
ctx.builder.CreateUnreachable();
CreateTrap(ctx.builder, false);
find_next_stmt(-1);
continue;
}
Expand Down
1 change: 0 additions & 1 deletion src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ static Value *emit_unboxed_coercion(jl_codectx_t &ctx, Type *to, Value *unboxed)
Type *ty = unboxed->getType();
if (ty == to)
return unboxed;
assert(to->isIntOrPtrTy() || to->isFloatingPointTy());
bool frompointer = ty->isPointerTy();
bool topointer = to->isPointerTy();
const DataLayout &DL = jl_data_layout;
Expand Down
Loading