mirror of https://github.com/google/gemma.cpp.git
Restored original filenames. kept BlobReader to BlobFinder class rename
This commit is contained in:
parent
5579abb4e6
commit
b99790450c
|
|
@ -99,8 +99,8 @@ set(SOURCES
|
||||||
gemma/vit.h
|
gemma/vit.h
|
||||||
gemma/weights.cc
|
gemma/weights.cc
|
||||||
gemma/weights.h
|
gemma/weights.h
|
||||||
io/blob_finder.cc
|
io/blob_store.cc
|
||||||
io/blob_finder.h
|
io/blob_store.h
|
||||||
io/fields.cc
|
io/fields.cc
|
||||||
io/fields.h
|
io/fields.h
|
||||||
io/io_win.cc
|
io/io_win.cc
|
||||||
|
|
@ -225,7 +225,7 @@ set(GEMMA_TEST_FILES
|
||||||
gemma/gemma_args_test.cc
|
gemma/gemma_args_test.cc
|
||||||
gemma/flash_attention_test.cc
|
gemma/flash_attention_test.cc
|
||||||
gemma/tensor_info_test.cc
|
gemma/tensor_info_test.cc
|
||||||
io/blob_finder_test.cc
|
io/blob_store_test.cc
|
||||||
io/fields_test.cc
|
io/fields_test.cc
|
||||||
ops/bench_matmul.cc
|
ops/bench_matmul.cc
|
||||||
ops/dot_test.cc
|
ops/dot_test.cc
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "io/blob_finder.h"
|
#include "io/blob_store.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -412,8 +412,8 @@ class BlobStore {
|
||||||
std::vector<hwy::uint128_t> directory_; // two per blob, see `SetRange`.
|
std::vector<hwy::uint128_t> directory_; // two per blob, see `SetRange`.
|
||||||
}; // BlobStore
|
}; // BlobStore
|
||||||
|
|
||||||
BlobReader::BlobReader(const Path& blob_path) : blob_path_(blob_path) {
|
BlobFinder::BlobFinder(const Path& blob_path) : blob_path_(blob_path) {
|
||||||
PROFILER_ZONE("Startup.BlobReader");
|
PROFILER_ZONE("Startup.BlobFinder");
|
||||||
|
|
||||||
file_ = OpenFileOrAbort(blob_path, "r");
|
file_ = OpenFileOrAbort(blob_path, "r");
|
||||||
file_bytes_ = file_->FileSize();
|
file_bytes_ = file_->FileSize();
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#ifndef THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_
|
#ifndef THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
|
||||||
#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_
|
#define THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
|
||||||
|
|
||||||
// Reads/writes arrays of bytes from/to file.
|
// Reads/writes arrays of bytes from/to file.
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct BlobRange {
|
||||||
|
|
||||||
// Reads `BlobStore` header, converts keys to strings and creates a hash map for
|
// Reads `BlobStore` header, converts keys to strings and creates a hash map for
|
||||||
// faster lookups.
|
// faster lookups.
|
||||||
// TODO(janwas): rename to BlobFinder or similar.
|
// Finds and manages the location of data blobs within the store.
|
||||||
// Thread-safe: it is safe to concurrently call all methods except `CloseFile`.
|
// Thread-safe: it is safe to concurrently call all methods except `CloseFile`.
|
||||||
class BlobFinder {
|
class BlobFinder {
|
||||||
public:
|
public:
|
||||||
|
|
@ -136,4 +136,4 @@ class BlobWriter {
|
||||||
|
|
||||||
} // namespace gcpp
|
} // namespace gcpp
|
||||||
|
|
||||||
#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_FINDER_H_
|
#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "io/blob_finder.h"
|
#include "io/blob_store.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
@ -32,10 +32,11 @@ namespace gcpp {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if !HWY_TEST_STANDALONE
|
#if !HWY_TEST_STANDALONE
|
||||||
class BlobFinderTest : public testing::Test {};
|
class BlobStoreTest : public testing::Test {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST(BlobFinderTest, TestReadWrite) {
|
// Change the first argument from BlobFinderTest to BlobStoreTest
|
||||||
|
TEST(BlobStoreTest, TestReadWrite) {
|
||||||
ThreadingArgs threading_args;
|
ThreadingArgs threading_args;
|
||||||
ThreadingContext ctx(threading_args);
|
ThreadingContext ctx(threading_args);
|
||||||
|
|
||||||
|
|
@ -92,7 +93,7 @@ TEST(BlobFinderTest, TestReadWrite) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensures padding works for any number of random-sized blobs.
|
// Ensures padding works for any number of random-sized blobs.
|
||||||
TEST(BlobFinderTest, TestNumBlobs) {
|
TEST(BlobStoreTest, TestNumBlobs) {
|
||||||
ThreadingArgs threading_args;
|
ThreadingArgs threading_args;
|
||||||
ThreadingContext ctx(threading_args);
|
ThreadingContext ctx(threading_args);
|
||||||
hwy::RandomState rng;
|
hwy::RandomState rng;
|
||||||
Loading…
Reference in New Issue