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

Restructure JIT to have more extension points and more logical control flow #50650

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

pchintalapudi
Copy link
Member

Rather than forking the optimize and compile layers into individual layers per optlevel, each optimize and compile layer will switch on the requested optlevel of the module, which reduces the complexity of tracing a module's path through the JIT. In addition, this lets us move some of the addModule code to happen post-optimization, which makes the optimization pipeline not see literal pointers except those generated by codegen.

@pchintalapudi pchintalapudi added compiler:codegen Generation of LLVM IR and native code compiler:llvm For issues that relate to LLVM labels Jul 24, 2023
@pchintalapudi pchintalapudi marked this pull request as draft July 24, 2023 05:44
PoolIdx = jl_options.opt_level;
}
assert(PoolIdx < N && "Invalid optimization level for compiler!");
return orc::SimpleCompiler(****TMs[PoolIdx])(M);
Copy link
Member

Choose a reason for hiding this comment

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

😂 ****[]

@pchintalapudi pchintalapudi marked this pull request as ready for review July 25, 2023 22:34
Base automatically changed from pc/cleanups2 to master July 26, 2023 13:32
@pchintalapudi pchintalapudi added the merge me PR is reviewed. Merge when all tests are passing label Jul 26, 2023
@vtjnash
Copy link
Member

vtjnash commented Jul 27, 2023

      From worker 12:	Exception: EXCEPTION_ACCESS_VIOLATION at 0x127763b -- RefValue at .\refvalue.jl:8 [inlined]
      From worker 12:	RefValue at .\refvalue.jl:10 [inlined]
      From worker 12:	Ref at .\refpointer.jl:137 [inlined]
      From worker 12:	getpwuid at .\libc.jl:442
      From worker 12:	in expression starting at C:\buildkite-agent\builds\win2k22-amdci6-5\julialang\julia-master\julia-7a67140fa3\share\julia\test\file.jl:752
Worker 12 terminated.

      From worker 12:	RefValue at .\refvalue.jl:8 [inlined]
      From worker 12:	RefValue at .\refvalue.jl:10 [inlined]
      From worker 12:	Ref at .\refpointer.jl:137 [inlined]
      From worker 12:	getpwuid at .\libc.jl:442
      From worker 12:	getusername at .\stat.jl:93 [inlined]
      From worker 12:	show_statstruct at .\stat.jl:121
      From worker 12:	show at .\stat.jl:142

:/

@vtjnash vtjnash merged commit 943db02 into master Jul 27, 2023
@vtjnash vtjnash deleted the pc/restructure-jit branch July 27, 2023 15:17
@vtjnash
Copy link
Member

vtjnash commented Jul 27, 2023

    call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 16 dereferenceable(48) %.sub, i8* noundef nonnull align 16 dereferenceable(48) bitcast ([6 x i64]* @"_j_const#1" to i8*), i64 48, i1 false), !dbg !29

@vtjnash
Copy link
Member

vtjnash commented Jul 27, 2023

The code here is wrong (missing a compatible alignment attribute with the memcpy):

@"_j_const#1" = private unnamed_addr constant [6 x i64] [i64 0, i64 -1, i64 -1, i64 0, i64 0, i64 0]

@pchintalapudi pchintalapudi removed the merge me PR is reviewed. Merge when all tests are passing label Jul 30, 2023
vtjnash pushed a commit that referenced this pull request Aug 1, 2023
We shouldn't merge non-external definitions in `jl_merge_module`, so
that we can freely emit internal globals without relying on a global
counter.

Depends on #50650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code compiler:llvm For issues that relate to LLVM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants