Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bollu/captainslog
Documenting the PhD slog, one day at a time
https://github.com/bollu/captainslog
Last synced: 20 days ago
JSON representation
Documenting the PhD slog, one day at a time
- Host: GitHub
- URL: https://github.com/bollu/captainslog
- Owner: bollu
- Created: 2022-08-08T12:09:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-20T21:16:16.000Z (over 2 years ago)
- Last Synced: 2023-08-04T01:05:23.101Z (over 1 year ago)
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* Documenting the PhD slog, one day at a time*
#+TODO: TODO | CURRENT | DONE
# https://writequit.org/denver-emacs/presentations/2017-04-11-time-clocking-with-org.html#+BEGIN: clocktable :scope subtree :maxlevel 4 :block today
#+CAPTION: Clock summary at [2022-09-20 Tue 22:15], for Tuesday, September 20, 2022.
| Headline | Time | | | |
|------------------------------------------+--------+------+------+------|
| *Total time* | *6:36* | | | |
|------------------------------------------+--------+------+------+------|
| Documenting the PhD slog, one day at... | 6:36 | | | |
| \_ Time Tracking | | 6:36 | | |
| \_ Paper Writing | | | 4:45 | |
| \_ Egg Paper | | | | 4:31 |
| \_ Hold Space: MLIR Semantics Paper | | | | 0:14 |
| \_ Math Distraction | | | 1:30 | |
| \_ Arguing With Mario | | | | 0:30 |
| \_ Sheaves in Geometry and Logic | | | | 1:00 |
| \_ Breaks | | | 0:21 | |
| \_ Lunch | | | | 0:21 |
#+END:** Time Tracking
*** Exploratory Programming
**** TODO [#A] Dialect projection theory: Minimal Eg. Stx/Sem
:PROPERTIES:
:Effort: 2d
:ORDERED: t
:END:
:LOGBOOK:
CLOCK: [2022-09-15 Thu 17:29]--[2022-09-15 Thu 18:44] => 1:15
CLOCK: [2022-09-15 Thu 12:00]--[2022-09-15 Thu 13:06] => 1:06
CLOCK: [2022-09-14 Wed 17:17]--[2022-09-14 Wed 18:50] => 1:33
CLOCK: [2022-09-14 Wed 16:54]--[2022-09-14 Wed 17:10] => 0:16
CLOCK: [2022-09-14 Wed 16:04]--[2022-09-14 Wed 16:47] => 0:43
CLOCK: [2022-09-14 Wed 15:48]--[2022-09-14 Wed 16:00] => 0:12
CLOCK: [2022-09-14 Wed 15:46]--[2022-09-14 Wed 15:46] => 0:00
CLOCK: [2022-09-14 Wed 14:13]--[2022-09-14 Wed 15:17] => 1:04
CLOCK: [2022-09-14 Wed 14:07]--[2022-09-14 Wed 14:12] => 0:05
CLOCK: [2022-09-14 Wed 13:55]--[2022-09-14 Wed 14:05] => 0:10
CLOCK: [2022-09-14 Wed 13:54]--[2022-09-14 Wed 13:55] => 0:01
CLOCK: [2022-09-09 Fri 16:34]--[2022-09-09 Fri 17:31] => 0:57
:END:
**** TODO [#Z] Collect Evaluation Benchmark for `lean-mlir` linalg proofs.*** Engineering Programming
**** TODO [#A] Figure out evaluation section for PLDI
:LOGBOOK:
CLOCK: [2022-09-15 Thu 14:45]--[2022-09-15 Thu 15:00] => 0:15
CLOCK: [2022-09-15 Thu 12:00]--[2022-09-15 Thu 12:00] => 0:00
:END:Combinational dialect test:
- Canonicalization tests: https://github.com/llvm/circt/blob/af0df5ae8158aebe0ee67e5dc4f54db1c9966c8e/test/Dialect/Comb/canonicalization.mlir
- Constant folders: https://github.com/llvm/circt/blob/main/lib/Dialect/Comb/CombFolds.cpp
- Compute known bits:https://github.com/llvm/circt/blob/main/lib/Dialect/Comb/CombAnalysis.cpp**** TODO [#A] Sheperd LLVM bindings for Lean4 patch.
:LOGBOOK:
CLOCK: [2022-09-15 Thu 09:30]--[2022-09-15 Thu 10:00] => 0:30
CLOCK: [2022-09-09 Fri 17:31]--[2022-09-09 Fri 17:46] => 0:15
CLOCK: [2022-09-09 Fri 15:36]--[2022-09-09 Fri 15:44] => 0:08
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:14] => 0:00
:END:**** TODO [#B] Cleanup LLVM codegen for Lean4 patch
**** TODO [#Z] Delinearization proofs
:LOGBOOK:
CLOCK: [2022-09-09 Fri 13:10]--[2022-09-09 Fri 14:00] => 0:50
CLOCK: [2022-09-08 Thu 17:14]--[2022-09-08 Thu 19:50] => 2:36
CLOCK: [2022-09-08 Thu 16:48]--[2022-09-08 Thu 16:48] => 0:00
:END:*** Studying for paper
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:15]--[2022-09-08 Thu 11:16] => 0:01
:END:**** TODO [#B] Partial Evaluation for lambda calculus
*** Admin Stuff
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:16]--[2022-09-08 Thu 11:17] => 0:01
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:14] => 0:00
:END:**** TODO [#A] Letter of Recommendations.
**** TODO [#A] Seattle Booking LLVM Dev 2022.
**** TODO [#B] Train Ticket Booking Haskell Friends.
**** DONE [#A] Flight Booking LLVM Dev 2022
**** DONE [#B] Ping Admin about going home in February.
:LOGBOOK:
CLOCK: [2022-09-15 Thu 11:54]--[2022-09-15 Thu 12:00] => 0:06
:END:
**** DONE [#B] Book Room for Sheaves in Gtry&Logic.
:LOGBOOK:
CLOCK: [2022-09-14 Wed 16:47]--[2022-09-14 Wed 16:54] => 0:07
CLOCK: [2022-09-14 Wed 16:00]--[2022-09-14 Wed 16:04] => 0:04
CLOCK: [2022-09-09 Fri 16:05]--[2022-09-09 Fri 16:09] => 0:04
:END:
**** DONE [#A] Fill LLVM Travel grant.*** Rebuttal Writing
**** DONE [#A] lean-mlir POPL 2022 rebuttal
:LOGBOOK:
CLOCK: [2022-09-09 Fri 12:40]--[2022-09-09 Fri 13:10] => 0:30
:END:*** Paper Writing
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:17]--[2022-09-08 Thu 11:32] => 0:15
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:14] => 0:00
:END:**** DONE [#Z] Egg Abstract
SCHEDULED: <2022-09-15 Thu 11:55>
:LOGBOOK:
CLOCK: [2022-09-14 Wed 15:17]--[2022-09-14 Wed 15:34] => 0:17
:END:**** TODO [#A] Egg Paper
SCHEDULED: <2022-09-22 Thu 11:55>
:LOGBOOK:
CLOCK: [2022-09-20 Tue 16:00]--[2022-09-20 Tue 18:00] => 2:00
CLOCK: [2022-09-20 Tue 13:53]--[2022-09-20 Tue 15:24] => 1:31
CLOCK: [2022-09-20 Tue 11:30]--[2022-09-20 Tue 12:30] => 1:00
:END:**** TODO [#A] Hold Space: MLIR Semantics Paper
:LOGBOOK:
CLOCK: [2022-09-20 Tue 22:14]
CLOCK: [2022-09-20 Tue 22:00]--[2022-09-20 Tue 22:14] => 0:14
:END:*** Meetings
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:15] => 0:01
:END:**** Lean4 Backend
SCHEDULED: <2022-09-09 Fri +1w>**** Performance Coaching
:LOGBOOK:
CLOCK: [2022-09-15 Thu 15:30]--[2022-09-15 Fri 16:45] => 1:15
:END:**** Lean4 Codegen
SCHEDULED: <2022-09-12 Mon +1w>**** Tobias Meeting
SCHEDULED: <2022-09-12 Mon +1w>:LOGBOOK:
CLOCK: [2022-09-09 Fri 14:00]--[2022-09-09 Fri 15:20] => 1:20
:END:*** Math Distraction
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:14] => 0:00
:END:**** Arguing With Mario
:LOGBOOK:
CLOCK: [2022-09-20 Tue 12:30]--[2022-09-20 Tue 13:00] => 0:30
:END:**** Sheaves in Geometry and Logic
:LOGBOOK:
CLOCK: [2022-09-20 Tue 21:00]--[2022-09-20 Tue 22:00] => 1:00
:END:*** Programming Distraction
:LOGBOOK:
CLOCK: [2022-09-08 Thu 11:32]--[2022-09-08 Thu 11:54] => 0:22
CLOCK: [2022-09-08 Thu 11:14]--[2022-09-08 Thu 11:14] => 0:00
:END:**** Collect list of questions for Leo meeting
:LOGBOOK:
CLOCK: [2022-09-09 Fri 16:10]--[2022-09-09 Fri 16:30] => 0:20
:END:- Precise semantics of ~impure~ ?
*** Breaks
**** TODO [#Z] Lunch
:LOGBOOK:
CLOCK: [2022-09-20 Tue 15:24]--[2022-09-20 Tue 15:45] => 0:21
:END:
**** TODO [#Z] Coffee
:LOGBOOK:
CLOCK: [2022-09-14 Wed 17:10]--[2022-09-14 Wed 17:17] => 0:07
CLOCK: [2022-09-14 Wed 17:10]--[2022-09-14 Wed 17:10] => 0:00
CLOCK: [2022-09-14 Wed 15:47]--[2022-09-14 Wed 15:47] => 0:00
CLOCK: [2022-09-14 Wed 15:46]--[2022-09-14 Wed 15:46] => 0:00
CLOCK: [2022-09-14 Wed 15:46]--[2022-09-14 Wed 15:46] => 0:00
CLOCK: [2022-09-14 Wed 15:34]--[2022-09-14 Wed 15:44] => 0:10
CLOCK: [2022-09-09 Fri 15:45]--[2022-09-09 Fri 15:59] => 0:14
:END:*** Life Stuff
***** TODO [#C] Pickup parcel from royal mail
***** TODO [#C] Buy shoes that don't get wet** Meetings with Leo (Monday/Friday)
- Meeting URL: https://moderated.jitsi.net/f0202a1b2e2947f3bf5176e708f82a2857260acf2d0f4fa6b356ae9fba614318
*** LCNF Ideas
- Have LCNF as macro_rules.
- Collapse cases with default. This can collapse with join points, which gives more simplification.#+BEGIN_SRC lean
case x of
| a -> f 1; jmp k
| b -> f 2; jmp k
| c -> f 3; jmp k
#+END_SRC
- Constant folding / partial evaluation for LCNF.
- Look at the code generated via LCNF.
- We have two different notions of type checking. One with LCNF ~ LCNF, and one with LCNF ~ CIC.**** Benchmarking LCNF
- Finishing the simplifier
- Moving the specializer.
- Send a PR that adds a value domain, so we can directly codegen the static
values.
- how to bench: do compile twice, first time is to make sure we compile all dependencies.
Then do set_option profiler true, and then recompile.
- ~perf report~ : Increase stack size, sort by time.
Count the number of inlined functions, visited nodes, inlined local functions, etc.*** Lean4 LLVM Meeting Notes <2022-09-09 Fri>
- What is ~@[impure]~, ~@[pure]~, ~unsafeIO~?
- ~@[impure]~ means it is impure? Impure is transitive, ~@[pure]~ breaks this transitive chain?
- What is the advantage of ~@[nospecialize]~? Are we "just" making sure that we generate
fewer instances?*** 2022 August 8
***** C to Isabelle
- [AutoCorres](https://trustworthy.systems/projects/TS/autocorres/)
- [PhD thesis: Automated proof producing abstraction of C code](https://trustworthy.systems/publications/nicta_full_text/8758.pdf)***** Lean Dev meeting
- Dev meeting: next thursday, 8 am pacific time (4 pm BST).
***** Target triple
- Cmake can find target triple: https://github.com/google/libcxx/blob/master/cmake/Modules/GetTriple.cmake
- LLVM knows everything about a triple: https://llvm.org/doxygen/group__LLVMCTarget.html
- LLVMGetTargetFromTriple: const char * → LLVMTargetRef
- LLVMCreateTargetMachine: LLVMTargetRef → LLVMTargetMachineRef
- LLVMCreateTargetDataLayout: LLVMTargetMachineRef → LLVMTargetDataRef
- LLVMIntPtrType: LLVMTargetDataRef → LLVMTypeRef
- Triple::getOs: llvm::Triple → OS [can be used for our `#if WINDOWS`]***** Leanc
- Must add a `--print-triple` to get target triple info?
- How does rust do this?***** ~lean_inline.cpp~
- Had to manually copy from `lean_inlines.h` and replace `static inline` with `extrn "C" LEANSHARED`.
- More sensible distribution story?***** Action points
1. Send PR for LLVM bindings. [`LLVMBindings.lean`. Merge this]
2. Add lake support for LLVM IR via facets?
3. Don't we only need ~lean_inlines.cpp`~ Why do we need the others? We can link `libleanshared` separately
at link-time, and only use ~lean_inlnes.cpp~ during LLVM module optmisation time.
4. We need three tools: ~llvm-link, opt, llc~ (this is *Critical*).
5. `lean_system_platform_nbits` to get the number of bits in a pointer.
6. Bootstrapping? Solve the `i32/i64` difference between the two platforms. Use a type alias that is later specialized?
(This is *Critical*).
7. New IR: memory layout.
8. Have `alwaysinline` and `musttailcall` in `EmitLLVM`.
9. Split the compilation pipeline in `.lean` to `.olean`, followed by `.olean` to `.ir`,and then to `.bc/.llvm/.c/.wasm`.
(Ask in the lean4-dev, Mac would know where we would need to change in `lake`.)
10. `ccache`? Maintain cache ourselves (?)***** Notes by ~mac~ on writing a plugin for ~lake~ for new backend
Here are some notes on a how a new backend (and a separate C backend) would be implemented in Lake.
***** Separate C Backend
If the C backend is separated from the `olean`/`ilean` build (and is thus able
to be built separately), one should ideally remove the whole `isLeanOnly`
configuration and replace it with just a separate build step.This would entail removing the `isLeanOnly` option from `PackageConfig` and
`Package`, the C build from `Module.buildUnlessUpToDate`, and the C related
code from `Module.recBuildLean`. Then, one would add a separate build function
as below for the C code.***** New Backend
To add a new build step from the ~olean/ilean~, add a new facet ala the current
~o~ facet (and its build function ~buildLeanO~) that waits for the the module
build and then builds the desired file. For example:#+BEGIN_SRC lean
def Module.recBuildLeanLl (self : Module) : IndexBuildM (BuildJob FilePath) := do
buildLeanLl self.name.toString self.llFile (← self.leanBin.fetch) self.llArgsdef Module.oFacetConfig : ModuleFacetConfig llFacet :=
mkFacetJobConfig Module.recBuildLeanLl
#+END_SRC*** 2022 Aug 1
***** Target triple
- Cmake can find target triple: https://github.com/google/libcxx/blob/master/cmake/Modules/GetTriple.cmake
- LLVM knows everything about a triple: https://llvm.org/doxygen/group__LLVMCTarget.html
- LLVMGetTargetFromTriple: const char * → LLVMTargetRef
- LLVMCreateTargetMachine: LLVMTargetRef → LLVMTargetMachineRef
- LLVMCreateTargetDataLayout: LLVMTargetMachineRef → LLVMTargetDataRef
- LLVMIntPtrType: LLVMTargetDataRef → LLVMTypeRef
- Triple::getOs: llvm::Triple → OS [can be used for our `#if WINDOWS`]- How does rust do this?
***** lean_inline.cpp
- Had to manually copy from `lean_inlines.h` and replace `static inline` with `extrn "C" LEANSHARED`.
- More sensible distribution story?***** Action points
1. Send PR for LLVM bindings. [`LLVMBindings.lean`. Merge this]
2. Add lake support for LLVM IR via facets?
3. Don't we only need `lean_inlines.cpp`? Why do we need the others? We can link `libleanshared` separately
at link-time, and only use `lean_inlnes.cpp` during LLVM module optmisation time.
4. We need three tools: `llvm-link`, `opt`, `llc`. (this is *Critical*).
5. `lean_system_platform_nbits` to get the number of bits in a pointer.
6. Bootstrapping? Solve the `i32/i64` difference between the two platforms. Use a type alias that is later specialized?
(This is *Critical*).
7. New IR: memory layout.
8. Have `alwaysinline` and `musttailcall` in `EmitLLVM`.
9. Split the compilation pipeline in `.lean` to `.olean`, followed by `.olean` to `.ir`,and then to `.bc/.llvm/.c/.wasm`.
(Ask in the lean4-dev, Mac would know where we would need to change in `lake`.)
10. `ccache`? Maintain cache ourselves (?)Dev meeting: next thursday, 8 am pacific time (4 pm BST).
def foo: Int → Id Bool := fun n => true
def bar: Bool → Id Nat := fun n => 10abbrev M := ReaderT Int Id
def main_: M Nat := do
-- let k ← (foo 1 >>= (fun x => bar x))
let k ← (foo 1 >>= bar)
return (k + 1)-- Research ideas:
-- 1. Kevin Buzzard's idea of computing $SOME_MATH_THING fast
-- 2. partial evaluation for compiler** Logbook
*** <2022-09-14 Wed>- Worked on Dialect projection theory. I have two ideas, one based on using 'Trees That Grow',
and one based on 'Final Tagless'
- 'Trees that Grow': We make our MLIR AST "customizable", so different consumers of our MLIR AST will use the
same AST type, "customized" to their needs, and provide coercions.
- 'Final Tagless': We use an encoding of our data type based on how it is consumed (final) instead of
how it is produced (initial). This automatically makes it compositional by construction, and we can
define different semantics for a language: (a) encode the language as MLIR, (b) provide an interpreter
of the language.
- Got a windows machine up and running that I can SSH into
- **Today:** Send Mathieu my flight tickets info.
- **Today:** Get a simple example working with dialect projection with both 'Trees that grow' and 'Final tagless'
- **Today:** Fiddle with windows box for `lean-llvm` builds. This helps establish me as the
second person other than Sebastian Ullrich who knows how to get the lean build working
on all platforms.