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

release-1.9: Backports for julia 1.9.0-alpha2 / 1.9.0-beta1 #47602

Merged
merged 57 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
05c8f3b
Limit initial OpenBLAS thread count (#46844)
staticfloat Nov 15, 2022
9606388
fix #46778, precompile() for abstract but compileable signatures (#47…
JeffBezanson Nov 16, 2022
0e17295
fix #47410, syntax error with anonfn inside `elseif` and short-circui…
JeffBezanson Nov 16, 2022
9dfd76b
ensure bindings handle write barriers for ty and globalref (#47580)
vtjnash Nov 16, 2022
d85e9ac
Turn on Intel jitevents by default on Linux (#47586)
vchuravy Nov 20, 2022
b5d6b03
Doc: The default sorting alg. is stable from 1.9 (#47579)
petvana Nov 21, 2022
3bc94a9
update MPFR (#47659)
simonbyrne Nov 21, 2022
f8f0c63
Add compat note for `sortperm(x; dims)` (#47657)
mcabbott Nov 22, 2022
382661c
build: add get-lld target (#47589)
petvana Nov 23, 2022
0f271d7
Print the detailed type on heap snapshot (#47503)
gbaraldi Nov 23, 2022
c615a49
Remove typeinfer lock altogether (#46825)
pchintalapudi Nov 23, 2022
3b414c6
Fix regression in generic_bitcast with Union{} arguments. (#47605)
maleadt Nov 24, 2022
aba112c
Filesystem: `rm(; recursive=true)` should ignore `UV_EACCES` (#47668)
staticfloat Nov 24, 2022
24505fc
Fix overflow in pow5 (#47511)
LilithHafner Nov 26, 2022
6fb45be
Fix GCExt test (#47699)
vchuravy Nov 27, 2022
0865ae0
Fix REPL keybinding CTRL-Q for stdlib methods (#47637)
rashidrafeek Nov 28, 2022
cfbb86a
fix 5-arg `mul!` for vectors of vectors (#47665)
ranocha Nov 28, 2022
93587d7
Add support for "package extensions" to code loading (#47695)
KristofferC Dec 7, 2022
dc1369e
🤖 Bump the Pkg stdlib from ed6a5497e to 5d8b9ddb8 (#47828)
DilumAluthgeBot Dec 7, 2022
9b9a703
Fix and simplify inference timing logic (#47711)
pchintalapudi Nov 26, 2022
1b85c1f
Fix nth_methtable tparam of -1 when n==0 (#47666)
apaz-cli Nov 28, 2022
81f8582
Fix generator-invocation legality check for varargs generators (#47739)
Keno Nov 29, 2022
9da50d2
Bump libuv. (#47707)
maleadt Nov 30, 2022
fcf02e8
Provider cycleclock() for 32bit ARM targets (#47358)
fingolfin Nov 30, 2022
628c953
strengthen setglobal to default to release-consume ordering (#47742)
vtjnash Nov 30, 2022
dfec160
fix unescaping in `global` expressions (#47719)
simeonschaub Dec 1, 2022
d8cbffd
Refactor and document sorting dispatch (#47383)
LilithHafner Dec 3, 2022
930314e
Comment out test in subtype that causes hang due to StackOverflow(#47…
vchuravy Dec 3, 2022
01ae8b7
Prioritize build_dir for generated headers (#47783)
vchuravy Dec 4, 2022
dba443d
Set `OPENBLAS_NUM_THREADS=1` on local Distributed workers (#47803)
staticfloat Dec 5, 2022
ce7a372
Add native julia fmod (#47501)
gbaraldi Dec 6, 2022
712a123
Fix libjulia install name and libjulia-internal rpath on OS X (#47220)
jonathan-conder-sm Dec 7, 2022
d561447
Replace the `.ji` serialization with sysimage format
timholy Feb 7, 2022
f8a5cd6
Allow re-initialization and caching of foreign types (#47407)
vchuravy Nov 27, 2022
12a4863
Fix physical_memory exports. (#47859)
maleadt Dec 10, 2022
2866e26
Fix missing GC root in Symbol construction (#47865)
Keno Dec 11, 2022
0b845b1
TOML: print: handle mixed vector of dicts and non-dicts (#47876)
fonsp Dec 12, 2022
3d80653
Fixups for #47383 (fixes `runbenchmarks("sort")`) (#47822)
LilithHafner Dec 13, 2022
a548ee3
fixes for jl_rewrap_unionall
vtjnash Nov 30, 2022
31df7c8
call specialized method instance when encountering unspecialized sparams
vtjnash Nov 19, 2022
9827f1d
ensure sparams are cached correctly for widened methods
vtjnash Nov 21, 2022
a506f43
ensure types are UnionAll wrapped are cached correctly for widened Va…
vtjnash Nov 22, 2022
3e1373e
add back wordaround for `Slot objects should not occur in an AST` in …
KristofferC Dec 14, 2022
5848e99
Reduce invalidations when loading JuliaData packages (#47889)
timholy Dec 15, 2022
86e8ef9
intersect: fix a minor soundness issue with supertypes (#47813)
vtjnash Dec 16, 2022
8432d4f
make Ctrl-C during sleeping work better (#47901)
JeffBezanson Dec 16, 2022
eba98e5
revert promotions of abstract arrays inside other arrays (#47893)
KristofferC Dec 19, 2022
a16ffd6
Revert "Emit safepoints at function entry (#41616)"
Dec 20, 2022
5a684f0
Revert "improve performance issue of `@nospecialize`-d keyword func c…
Dec 20, 2022
327e081
only load extensions once dependencies have finished loading (#47927)
KristofferC Dec 19, 2022
95cb3a8
Precompile cache: always add worklist CIs (#47924)
timholy Dec 20, 2022
f17d1df
put back the old QuickSort, PartialQuickSort, and MergeSort algorithm…
LilithHafner Dec 20, 2022
3ea7f6c
add bounds check to Slices indexing (#47622)
mcabbott Dec 20, 2022
22789c0
Reduce codegen lock scope (#46836)
pchintalapudi Dec 13, 2022
9a592dd
Implement support for object caching through pkgimages (#47184)
vchuravy Dec 27, 2022
7880930
Apply `InitialOptimizations` more consistently in sorting & fix dispa…
LilithHafner Dec 22, 2022
6adc428
Restore libgcc_s symlinkin in !macOS (#47986)
antonio-rojas Dec 24, 2022
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
Prev Previous commit
Next Next commit
Reduce codegen lock scope (#46836)
(cherry picked from commit 09a6ff8)
  • Loading branch information
pchintalapudi authored and KristofferC committed Dec 27, 2022
commit 22789c05e883edb69fb29f3bc891c760e23b41c1
33 changes: 18 additions & 15 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvm
jl_method_instance_t *mi = NULL;
jl_code_info_t *src = NULL;
JL_GC_PUSH1(&src);
JL_LOCK(&jl_codegen_lock);
auto ct = jl_current_task;
ct->reentrant_codegen++;
orc::ThreadSafeContext ctx;
Expand All @@ -278,16 +277,18 @@ void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvm
}
orc::ThreadSafeModule &clone = llvmmod ? *unwrap(llvmmod) : backing;
auto ctxt = clone.getContext();
jl_codegen_params_t params(ctxt);
params.params = cgparams;

uint64_t compiler_start_time = 0;
uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed(&jl_measure_compile_time_enabled);
if (measure_compile_time_enabled)
compiler_start_time = jl_hrtime();

params.imaging = imaging;

// compile all methods for the current world and type-inference world

JL_LOCK(&jl_codegen_lock);
jl_codegen_params_t params(ctxt);
params.params = cgparams;
params.imaging = imaging;
size_t compile_for[] = { jl_typeinf_world, jl_atomic_load_acquire(&jl_world_counter) };
for (int worlds = 0; worlds < 2; worlds++) {
params.world = compile_for[worlds];
Expand Down Expand Up @@ -332,15 +333,18 @@ void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvm
// finally, make sure all referenced methods also get compiled or fixed up
jl_compile_workqueue(emitted, *clone.getModuleUnlocked(), params, policy);
}
JL_UNLOCK(&jl_codegen_lock); // Might GC
JL_GC_POP();

// process the globals array, before jl_merge_module destroys them
std::vector<std::string> gvars;
std::vector<std::string> gvars(params.globals.size());
data->jl_value_to_llvm.resize(params.globals.size());

size_t idx = 0;
for (auto &global : params.globals) {
data->jl_value_to_llvm.at(gvars.size()) = global.first;
gvars.push_back(std::string(global.second->getName()));
gvars[idx] = global.second->getName().str();
data->jl_value_to_llvm[idx] = global.first;
idx++;
}
CreateNativeMethods += emitted.size();

Expand Down Expand Up @@ -423,7 +427,6 @@ void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvm
jl_ExecutionEngine->releaseContext(std::move(ctx));
}
ct->reentrant_codegen--;
JL_UNLOCK(&jl_codegen_lock); // Might GC
return (void*)data;
}

Expand Down Expand Up @@ -1013,17 +1016,18 @@ void jl_get_llvmf_defn_impl(jl_llvmf_dump_t* dump, jl_method_instance_t *mi, siz

// emit this function into a new llvm module
if (src && jl_is_code_info(src)) {
JL_LOCK(&jl_codegen_lock);
auto ctx = jl_ExecutionEngine->getContext();
jl_codegen_params_t output(*ctx);
output.world = world;
output.params = &params;
orc::ThreadSafeModule m = jl_create_llvm_module(name_from_method_instance(mi), output.tsctx, output.imaging);
orc::ThreadSafeModule m = jl_create_llvm_module(name_from_method_instance(mi), *ctx, imaging_default());
uint64_t compiler_start_time = 0;
uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed(&jl_measure_compile_time_enabled);
if (measure_compile_time_enabled)
compiler_start_time = jl_hrtime();
JL_LOCK(&jl_codegen_lock);
jl_codegen_params_t output(*ctx);
output.world = world;
output.params = &params;
auto decls = jl_emit_code(m, mi, src, jlrettype, output);
JL_UNLOCK(&jl_codegen_lock); // Might GC

Function *F = NULL;
if (m) {
Expand Down Expand Up @@ -1059,7 +1063,6 @@ void jl_get_llvmf_defn_impl(jl_llvmf_dump_t* dump, jl_method_instance_t *mi, siz
JL_GC_POP();
if (measure_compile_time_enabled)
jl_atomic_fetch_add_relaxed(&jl_cumulative_compile_time, (jl_hrtime() - compiler_start_time));
JL_UNLOCK(&jl_codegen_lock); // Might GC
if (F) {
dump->TSM = wrap(new orc::ThreadSafeModule(std::move(m)));
dump->F = wrap(F);
Expand Down
6 changes: 2 additions & 4 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3537,8 +3537,6 @@ int jl_has_concrete_subtype(jl_value_t *typ)
return ((jl_datatype_t*)typ)->has_concrete_subtype;
}

#define typeinf_lock jl_codegen_lock

JL_DLLEXPORT void jl_typeinf_timing_begin(void)
{
jl_task_t *ct = jl_current_task;
Expand All @@ -3561,7 +3559,7 @@ JL_DLLEXPORT void jl_typeinf_timing_end(void)

JL_DLLEXPORT void jl_typeinf_lock_begin(void)
{
JL_LOCK(&typeinf_lock);
JL_LOCK(&jl_codegen_lock);
//Although this is claiming to be a typeinfer lock, it is actually
//affecting the codegen lock count, not type inference's inferencing count
jl_task_t *ct = jl_current_task;
Expand All @@ -3572,7 +3570,7 @@ JL_DLLEXPORT void jl_typeinf_lock_end(void)
{
jl_task_t *ct = jl_current_task;
ct->reentrant_codegen--;
JL_UNLOCK(&typeinf_lock);
JL_UNLOCK(&jl_codegen_lock);
}

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ jl_value_t *jl_dump_method_asm_impl(jl_method_instance_t *mi, size_t world,
}
JL_GC_POP();
}
JL_UNLOCK(&jl_codegen_lock);
if (!--ct->reentrant_codegen && measure_compile_time_enabled)
jl_atomic_fetch_add_relaxed(&jl_cumulative_compile_time, (jl_hrtime() - compiler_start_time));
JL_UNLOCK(&jl_codegen_lock);
}
if (specfptr != 0)
return jl_dump_fptr_asm(specfptr, raw_mc, asm_variant, debuginfo, binary);
Expand Down