[llvm-branch-commits] Address review feedback (PR #113367)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/113367

None


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Address review feedback (PR #113367)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan closed 
https://github.com/llvm/llvm-project/pull/113367
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Address review feedback (PR #113361)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan closed 
https://github.com/llvm/llvm-project/pull/113361
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Address review feedback (PR #113361)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/113361

None


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Support: Add vfs::OutputBackend and OutputFile to virtualize compiler outputs (PR #113363)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/113363

Add OutputBackend and OutputFile to the `llvm::vfs` namespace for
virtualizing compiler outputs. This is intended for use in Clang,

The headers are:

- llvm/Support/VirtualOutputConfig.h
- llvm/Support/VirtualOutputError.h
- llvm/Support/VirtualOutputFile.h
- llvm/Support/VirtualOutputBackend.h

OutputFile is moveable and owns an OutputFileImpl, which is provided by
the derived OutputBackend.

- OutputFileImpl::keep() and OutputFileImpl::discard() should keep or
  discard the output.  OutputFile guarantees that exactly one of these
  will be called before destruction.
- OutputFile::keep() and OutputFile::discard() wrap OutputFileImpl
  and catch usage errors such as double-close.
- OutputFile::discardOnDestroy() installs an error handler for the
  destructor to use if the file is still open. The handler will be
  called if discard() fails.
- OutputFile::~OutputFile() calls report_fatal_error() if none of
  keep(), discard(), or discardOnDestroy() has been called. It still
  calls OutputFileImpl::discard().
- getOS() returns the wrapped raw_pwrite_stream. For convenience,
  OutputFile has an implicit conversion to `raw_ostream` and
  `raw_ostream &operator<<(OutputFile&, T&&)`.

OutputBackend can be stored in IntrusiveRefCntPtr.

- Most operations are thread-safe.
- clone() returns a backend that targets the same destination.
  All operations are thread-safe when done on different clones.
- createFile() takes a path and an OutputConfig (see below) and returns
  an OutputFile. Backends implement createFileImpl().

OutputConfig has flags to configure the output. Backends may ignore or
override flags that aren't relevant or implementable.

- The initial flags are:
- AtomicWrite: whether the output should appear atomically (e.g., by
  using a temporary file and renaming it).
- CrashCleanup: whether the output should be cleaned up if there's a
  crash (e.g., with RemoveFileOnSignal).
- ImplyCreateDirectories: whether to implicitly create missing
  directories in the path to the file.
- Text: matches sys::fs::OF_Text.
- CRLF: matches sys::fs::OF_CRLF.
- Append: matches sys::fs::OF_Append and can use with AtomicWrite
  for atomic append.
- Each "Flag" has `setFlag(bool)` and `bool getFlag()` and shortcuts
  `setFlag()` and `setNoFlag()`. The setters are `constexpr` and return
  `OutputConfig&` to make it easy to declare a default value for a filed
  in a class or struct.
- Setters and getters for Binary and TextWithCRLF are derived from Text
  and CRLF. For convenience, sys::fs::OpenFlags can be passed
  directly to setOpenFlags().

This patch intentionally lacks a number of important features that have
been left for follow-ups:

- Set a (virtual) current working directory.
- Create a directory.
- Create a file or directory with a unique name (avoiding collisions
  with existing filenames).

Patch originally by dexonsmith



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (PR #113364)

2024-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/113364

Adopt new virtual output backend in CompilerInstance.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114093)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114093

Add a command-line tool `llvm-cas` to inspect the OnDisk CAS for
debugging purpose. It can be used to lookup/update ObjectStore or
put/get cache entries from ActionCache, together with other debugging
capabilities.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114094)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan closed 
https://github.com/llvm/llvm-project/pull/114094
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114094)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114094

Add a command-line tool `llvm-cas` to inspect the OnDisk CAS for
debugging purpose. It can be used to lookup/update ObjectStore or
put/get cache entries from ActionCache, together with other debugging
capabilities.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114093)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan closed 
https://github.com/llvm/llvm-project/pull/114093
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114104

Add a command-line tool `llvm-cas` to inspect the OnDisk CAS for
debugging purpose. It can be used to lookup/update ObjectStore or
put/get cache entries from ActionCache, together with other debugging
capabilities.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskCAS (PR #114103)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114103

Add OnDiskCAS abstraction, that implements ObjectStore and ActionCache
interface using OnDiskGraphDB and OnDiskKeyValueDB.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskGraphDB and OnDiskKeyValueDB (PR #114102)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114102

Add OnDiskGraphDB and OnDiskKeyValueDB that can be used to implement
ObjectStore and ActionCache respectively. Those are on-disk persistent
storage that build upon OnDiskTrieHashMap and implements key functions
that are required by LLVMCAS interfaces.

This abstraction layer defines how the objects are hashed and stored on
disk. OnDiskKeyValueDB is a basic OnDiskTrieHashMap while OnDiskGraphDB
also defines:
* How objects of various size are store on disk and are referenced by
  the trie nodes.
* How to store the references from one stored object to another object
  that is referenced.

In addition to basic APIs for ObjectStore and ActionCache, other
advances database configuration features can be implemented in this
layer without exposing to the users of the LLVMCAS interface. For
example, OnDiskGraphDB has a faulty in function to fetch data from an
upstream OnDiskGraphDB if the data is missing.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [FileSystem] Allow exclusive file lock (PR #114098)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114098

Add parameter to file lock API to allow exclusive file lock. Both Unix
and Windows support lock the file exclusively for write for one process
and LLVM OnDiskCAS uses exclusive file lock to coordinate CAS creation.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add ActionCache to LLVMCAS Library (PR #114097)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114097

ActionCache is used to store a mapping from CASID to CASID. The current
implementation of the ActionCache can only be used to associate the
key/value from the same hash context.

ActionCache has two operations: `put` to store the key/value and `get` to
lookup the key/value mapping. ActionCache uses the same TrieRawHashMap
data structure to store the mapping, where is CASID of the key is the
hash to index the map.

While CASIDs for key/value are often associcate with actual CAS
ObjectStore, it doesn't provide the guarantee of the existence of such
object in any ObjectStore.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add MappedFileRegionBumpPtr (PR #114099)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114099

Add MappedFileRegionBumpPtr which can be served as a file system backed
persistent memory allocator. The allocator works like a BumpPtrAllocator,
and is designed to be thread safe and process safe.

The implementation relies on the POSIX compliance of file system and
doesn't work on all file systems. If the file system supports lazy tail
(doesn't allocate disk space if the tail of the large file is not used),
user has more flexibility to declare a larger capacity.

The allocator works by using a atomically updated bump ptr at a location
that can be customized by the user. The atomic pointer points to the
next available space to allocate, and the allocator will resize/truncate
to current usage once all clients closed the allocator.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskHashMappedTrie (PR #114100)

2024-10-29 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan created 
https://github.com/llvm/llvm-project/pull/114100

Add OnDiskHashMappedTrie. This is a on-disk persistent hash map that
uses a Trie data structure that is similar to TrieRawHashMap.
OnDiskHashMappedTrie is thread safe and process safe. It is mostly lock
free, except it internally coordinates cross process creation and
closing using file lock.

TODO: consider rename to OnDiskTrieHashMap to match TrieRawHashMap.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][CodeGen] Remove CWD fallback in compilation directory (PR #150130)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150130


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][CodeGen] Remove CWD fallback in compilation directory (PR #150130)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150130


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ScanDeps] Clear compilation directory if needed (PR #150129)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150129


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ScanDeps] Clear compilation directory if needed (PR #150129)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150129


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ScanDeps] Clear compilation directory if needed (PR #150129)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150129


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ScanDeps] Clear compilation directory if needed (PR #150129)

2025-07-31 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/150129


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add MappedFileRegionBumpPtr (PR #114099)

2025-08-15 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114099


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add MappedFileRegionBumpPtr (PR #114099)

2025-08-15 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114099


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskGraphDB and OnDiskKeyValueDB (PR #114102)

2025-10-13 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114102


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (PR #113364)

2025-09-05 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/113364


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (PR #113364)

2025-09-05 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/113364


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (PR #113364)

2025-09-03 Thread Steven Wu via llvm-branch-commits

cachemeifyoucan wrote:

> This seems good, perhaps after #113363 lands, it'd be interesting to rebase 
> and run some build-time tests, just to ensure it doesn't introduce 
> regressions.

Yup! We don't see anything on our end but it will be good to double check.

https://github.com/llvm/llvm-project/pull/113364
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (PR #113364)

2025-09-03 Thread Steven Wu via llvm-branch-commits

cachemeifyoucan wrote:

Before landing the other change and rebase this, I created a branch to 
benchmark compile time: 
https://llvm-compile-time-tracker.com/compare.php?from=3b3fc701d8f83d4ca30ee1c818fb7687336ac178&to=e5febfb1d9d880b4f7af5dc32194f479ee2adcd6&stat=instructions%3Au

Nothing stands out as regression.

https://github.com/llvm/llvm-project/pull/113364
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskGraphDB and OnDiskKeyValueDB (PR #114102)

2025-10-17 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114102


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Support: Add vfs::OutputBackend and OutputFile to virtualize compiler outputs (PR #113363)

2025-08-26 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/113363


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Support: Add vfs::OutputBackend and OutputFile to virtualize compiler outputs (PR #113363)

2025-08-26 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/113363


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskHashMappedTrie (PR #114100)

2025-09-15 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114100


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskHashMappedTrie (PR #114100)

2025-09-15 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114100


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskTrieRawHashMap (PR #114100)

2025-09-15 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan edited 
https://github.com/llvm/llvm-project/pull/114100
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104

>From 63c4928ed65fb2a83a4a25f3c098af7d931fc0af Mon Sep 17 00:00:00 2001
From: Steven Wu 
Date: Mon, 3 Nov 2025 12:09:19 -0800
Subject: [PATCH] clang-format

Created using spr 1.3.7
---
 llvm/tools/llvm-cas/llvm-cas.cpp | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/tools/llvm-cas/llvm-cas.cpp b/llvm/tools/llvm-cas/llvm-cas.cpp
index b1e4f606211b5..e59313eb808e8 100644
--- a/llvm/tools/llvm-cas/llvm-cas.cpp
+++ b/llvm/tools/llvm-cas/llvm-cas.cpp
@@ -175,13 +175,12 @@ int main(int Argc, char **Argv) {
   return validateObject(*CAS, ID);
 }
 
-static Expected>
-openBuffer(StringRef DataPath) {
+static Expected> openBuffer(StringRef DataPath) {
   if (DataPath.empty())
 return createStringError(inconvertibleErrorCode(), "--data missing");
-  return errorOrToExpected(
-  DataPath == "-" ? llvm::MemoryBuffer::getSTDIN()
-  : llvm::MemoryBuffer::getFile(DataPath));
+  return errorOrToExpected(DataPath == "-"
+   ? llvm::MemoryBuffer::getSTDIN()
+   : llvm::MemoryBuffer::getFile(DataPath));
 }
 
 int dump(ObjectStore &CAS) {
@@ -311,7 +310,7 @@ int validateIfNeeded(StringRef Path, bool CheckHash, bool 
Force,
 Exec = ExecStorage;
   }
   ValidationResult Result = 
ExitOnErr(validateOnDiskUnifiedCASDatabasesIfNeeded(
-Path, CheckHash, AllowRecovery, Force, Exec));
+  Path, CheckHash, AllowRecovery, Force, Exec));
   switch (Result) {
   case ValidationResult::Valid:
 outs() << "validated successfully\n";

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-04 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan closed 
https://github.com/llvm/llvm-project/pull/114104
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-04 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104

>From 63c4928ed65fb2a83a4a25f3c098af7d931fc0af Mon Sep 17 00:00:00 2001
From: Steven Wu 
Date: Mon, 3 Nov 2025 12:09:19 -0800
Subject: [PATCH 1/2] clang-format

Created using spr 1.3.7
---
 llvm/tools/llvm-cas/llvm-cas.cpp | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/tools/llvm-cas/llvm-cas.cpp b/llvm/tools/llvm-cas/llvm-cas.cpp
index b1e4f606211b5..e59313eb808e8 100644
--- a/llvm/tools/llvm-cas/llvm-cas.cpp
+++ b/llvm/tools/llvm-cas/llvm-cas.cpp
@@ -175,13 +175,12 @@ int main(int Argc, char **Argv) {
   return validateObject(*CAS, ID);
 }
 
-static Expected>
-openBuffer(StringRef DataPath) {
+static Expected> openBuffer(StringRef DataPath) {
   if (DataPath.empty())
 return createStringError(inconvertibleErrorCode(), "--data missing");
-  return errorOrToExpected(
-  DataPath == "-" ? llvm::MemoryBuffer::getSTDIN()
-  : llvm::MemoryBuffer::getFile(DataPath));
+  return errorOrToExpected(DataPath == "-"
+   ? llvm::MemoryBuffer::getSTDIN()
+   : llvm::MemoryBuffer::getFile(DataPath));
 }
 
 int dump(ObjectStore &CAS) {
@@ -311,7 +310,7 @@ int validateIfNeeded(StringRef Path, bool CheckHash, bool 
Force,
 Exec = ExecStorage;
   }
   ValidationResult Result = 
ExitOnErr(validateOnDiskUnifiedCASDatabasesIfNeeded(
-Path, CheckHash, AllowRecovery, Force, Exec));
+  Path, CheckHash, AllowRecovery, Force, Exec));
   switch (Result) {
   case ValidationResult::Valid:
 outs() << "validated successfully\n";

>From 76fbb642c630302353ae67a50df93db71e7f33cc Mon Sep 17 00:00:00 2001
From: Steven Wu 
Date: Mon, 3 Nov 2025 12:13:40 -0800
Subject: [PATCH 2/2] darker check fix

Created using spr 1.3.7
---
 llvm/test/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index b78dc10ff6ad5..bca196e80640b 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -789,7 +789,7 @@ def host_unwind_supports_jit():
 config.available_features.add("expensive_checks")
 
 if config.have_ondisk_cas:
-config.available_features.add('ondisk_cas')
+config.available_features.add("ondisk_cas")
 
 if "MemoryWithOrigins" in config.llvm_use_sanitizer:
 config.available_features.add("use_msan_with_origins")

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-04 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104




  
Unicorn! · GitHub

  body {
background-color: #f1f1f1;
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  }

  .container { margin: 50px auto 40px auto; width: 600px; text-align: 
center; }

  a { color: #4183c4; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { letter-spacing: -1px; line-height: 60px; font-size: 60px; 
font-weight: 100; margin: 0px; text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 10px 0 10px; font-size: 18px; 
font-weight: 200; line-height: 1.6em;}

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  


  

  

  No server is currently available to service your 
request.
  Sorry about that. Please try refreshing and contact us if the problem 
persists.
  
https://github.com/contact";>Contact Support —
https://www.githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114104

>From 63c4928ed65fb2a83a4a25f3c098af7d931fc0af Mon Sep 17 00:00:00 2001
From: Steven Wu 
Date: Mon, 3 Nov 2025 12:09:19 -0800
Subject: [PATCH 1/2] clang-format

Created using spr 1.3.7
---
 llvm/tools/llvm-cas/llvm-cas.cpp | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/tools/llvm-cas/llvm-cas.cpp b/llvm/tools/llvm-cas/llvm-cas.cpp
index b1e4f606211b5..e59313eb808e8 100644
--- a/llvm/tools/llvm-cas/llvm-cas.cpp
+++ b/llvm/tools/llvm-cas/llvm-cas.cpp
@@ -175,13 +175,12 @@ int main(int Argc, char **Argv) {
   return validateObject(*CAS, ID);
 }
 
-static Expected>
-openBuffer(StringRef DataPath) {
+static Expected> openBuffer(StringRef DataPath) {
   if (DataPath.empty())
 return createStringError(inconvertibleErrorCode(), "--data missing");
-  return errorOrToExpected(
-  DataPath == "-" ? llvm::MemoryBuffer::getSTDIN()
-  : llvm::MemoryBuffer::getFile(DataPath));
+  return errorOrToExpected(DataPath == "-"
+   ? llvm::MemoryBuffer::getSTDIN()
+   : llvm::MemoryBuffer::getFile(DataPath));
 }
 
 int dump(ObjectStore &CAS) {
@@ -311,7 +310,7 @@ int validateIfNeeded(StringRef Path, bool CheckHash, bool 
Force,
 Exec = ExecStorage;
   }
   ValidationResult Result = 
ExitOnErr(validateOnDiskUnifiedCASDatabasesIfNeeded(
-Path, CheckHash, AllowRecovery, Force, Exec));
+  Path, CheckHash, AllowRecovery, Force, Exec));
   switch (Result) {
   case ValidationResult::Valid:
 outs() << "validated successfully\n";

>From 76fbb642c630302353ae67a50df93db71e7f33cc Mon Sep 17 00:00:00 2001
From: Steven Wu 
Date: Mon, 3 Nov 2025 12:13:40 -0800
Subject: [PATCH 2/2] darker check fix

Created using spr 1.3.7
---
 llvm/test/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index b78dc10ff6ad5..bca196e80640b 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -789,7 +789,7 @@ def host_unwind_supports_jit():
 config.available_features.add("expensive_checks")
 
 if config.have_ondisk_cas:
-config.available_features.add('ondisk_cas')
+config.available_features.add("ondisk_cas")
 
 if "MemoryWithOrigins" in config.llvm_use_sanitizer:
 config.available_features.add("use_msan_with_origins")

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits


@@ -0,0 +1,332 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file A utility for operating on LLVM CAS.
+///
+//===--===//
+
+#include "llvm/CAS/ActionCache.h"
+#include "llvm/CAS/BuiltinUnifiedCASDatabases.h"
+#include "llvm/CAS/ObjectStore.h"
+#include "llvm/CAS/UnifiedOnDiskCache.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/InitLLVM.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+
+using namespace llvm;
+using namespace llvm::cas;
+
+static cl::list Inputs(cl::Positional, cl::desc("Input object"));
+
+static int dump(ObjectStore &CAS);
+static int listObjectReferences(ObjectStore &CAS, const CASID &ID);
+static int catNodeData(ObjectStore &CAS, const CASID &ID);
+static int makeBlob(ObjectStore &CAS, StringRef DataPath);
+static int makeNode(ObjectStore &CAS, ArrayRef References,
+StringRef DataPath);
+static int import(ObjectStore &FromCAS, ObjectStore &ToCAS,
+  ArrayRef Objects);
+static int putCacheKey(ObjectStore &CAS, ActionCache &AC,
+   ArrayRef Objects);
+static int getCacheResult(ObjectStore &CAS, ActionCache &AC, const CASID &ID);
+static int validateObject(ObjectStore &CAS, const CASID &ID);
+static int validate(ObjectStore &CAS, ActionCache &AC, bool CheckHash);
+static int validateIfNeeded(StringRef Path, bool CheckHash, bool Force,
+bool AllowRecovery, bool InProcess,
+const char *Argv0);
+static int prune(cas::ObjectStore &CAS);
+
+int main(int Argc, char **Argv) {
+  InitLLVM X(Argc, Argv);
+  cl::opt CASPath("cas", cl::desc("Path to CAS on disk."),
+   cl::value_desc("path"));
+  cl::opt UpstreamCASPath(
+  "upstream-cas", cl::desc("Path to another CAS."), 
cl::value_desc("path"));
+  cl::opt DataPath("data",
+cl::desc("Path to data or '-' for stdin."),
+cl::value_desc("path"));
+  cl::opt CheckHash("check-hash",
+  cl::desc("check all hashes during validation"));
+  cl::opt AllowRecovery("allow-recovery",
+  cl::desc("allow recovery of cas data"));
+  cl::opt Force("force",
+  cl::desc("force validation even if unnecessary"));
+  cl::opt InProcess("in-process", cl::desc("validate in-process"));
+
+  enum CommandKind {
+Invalid,
+Dump,
+CatNodeData,
+MakeBlob,
+MakeNode,
+ListObjectReferences,
+Import,
+PutCacheKey,
+GetCacheResult,
+Validate,
+ValidateObject,
+ValidateIfNeeded,
+Prune,
+  };
+  cl::opt Command(

cachemeifyoucan wrote:

Let me switch to OptTable no matter what. This started with a simple test tool 
but we end up shipping it because it is really helpful for debugging purposes.

https://github.com/llvm/llvm-project/pull/114104
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CAS] Add llvm-cas tools to inspect on-disk LLVMCAS (PR #114104)

2025-11-03 Thread Steven Wu via llvm-branch-commits


@@ -0,0 +1 @@
+content

cachemeifyoucan wrote:

This is a test input file named `nonewline` :) 

https://github.com/llvm/llvm-project/pull/114104
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskCAS (PR #114103)

2025-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114103


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CAS] Add OnDiskCAS (PR #114103)

2025-10-22 Thread Steven Wu via llvm-branch-commits

https://github.com/cachemeifyoucan updated 
https://github.com/llvm/llvm-project/pull/114103


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits