Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/ci-sharkfuser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
-DCMAKE_C_COMPILER=clang-20
-DCMAKE_CXX_COMPILER=clang++-20
-DCMAKE_BUILD_TYPE=Release
-DFUSILLI_ENABLE_LOGGING=ON
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if we want to do this? If we have automated benchmark numbers someday the logging will slow things down. Though on a CI machine benchmarks would already be quite noisy.

Copy link
Member

Choose a reason for hiding this comment

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

No harm I guess. Earlier we had logging on for debug builds only, but if we're trying to catch race issues, no harm in having better odds to catching it.

-DFUSILLI_SYSTEMS_AMDGPU=ON
- name: cpu_clang18_debug
runs-on: azure-cpubuilder-linux-scale
Expand Down
4 changes: 2 additions & 2 deletions sharkfuser/include/fusilli/support/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ inline ConditionalStreamer &getLogger() {
do { \
fusilli::ErrorObject _error = (expr); \
if (isError(_error)) { \
FUSILLI_LOG_LABEL_RED("ERROR: "); \
FUSILLI_LOG_LABEL_RED("ERROR: " << _error << " "); \
FUSILLI_LOG_ENDL(#expr << " at " << __FILE__ << ":" << __LINE__); \
return _error; \
} \
Expand All @@ -438,7 +438,7 @@ inline ConditionalStreamer &getLogger() {
({ \
auto _errorOr = (expr); \
if (isError(_errorOr)) { \
FUSILLI_LOG_LABEL_RED("ERROR: "); \
FUSILLI_LOG_LABEL_RED("ERROR: " << _errorOr << " "); \
FUSILLI_LOG_ENDL(#expr << " at " << __FILE__ << ":" << __LINE__); \
return fusilli::ErrorObject(_errorOr); \
} \
Expand Down
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_nchw_kcrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ TEST_CASE("Convolution fprop; X (NCHW), W (KCRS); 1x1 conv; no padding",
Y->setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, Y);
};
Expand Down Expand Up @@ -98,22 +98,22 @@ TEST_CASE("Convolution fprop; X (NCHW), W (KCRS); 1x1 conv; no padding",
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_nhwc_krsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding",
Y->setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, Y);
};
Expand Down Expand Up @@ -98,22 +98,22 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding",
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_nhwc_krsc_with_pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 3x3 conv; same padding",
Y->setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, Y);
};
Expand Down Expand Up @@ -98,20 +98,20 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 3x3 conv; same padding",
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
REQUIRE(result[0] == half(512.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
REQUIRE(result[0] == half(512.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_with_bias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding; bias",
biasResult->setName("result").setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, B, biasResult);
};
Expand Down Expand Up @@ -113,22 +113,22 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding; bias",
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(129.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(129.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_with_relu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding; relu",
reluResult->setName("result").setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, reluResult);
};
Expand Down Expand Up @@ -102,22 +102,22 @@ TEST_CASE("Convolution fprop; X (NHWC), W (KRSC); 1x1 conv; no padding; relu",
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(128.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/samples/convolution/conv_fprop_with_relu_and_bias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ TEST_CASE(
reluResult->setName("result").setOutput(true);

// Validate, infer missing properties
REQUIRE(isOk(graph->validate()));
FUSILLI_REQUIRE_OK(graph->validate());

// Compile
REQUIRE(isOk(graph->compile(handle, /*remove=*/true)));
FUSILLI_REQUIRE_OK(graph->compile(handle, /*remove=*/true));

return std::make_tuple(graph, X, W, B, reluResult);
};
Expand Down Expand Up @@ -118,22 +118,22 @@ TEST_CASE(
};

// Execute graph once.
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Read output buffers.
std::vector<half> result;
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(129.0f));

// Execute graph a few times.
constexpr size_t numIters = 1;
for (size_t i = 0; i < numIters; i++)
REQUIRE(isOk(graph->execute(variantPack)));
FUSILLI_REQUIRE_OK(graph->execute(variantPack));

// Repeat output buffer checks.
result.clear();
REQUIRE(isOk(yBuf->read(handle, result)));
FUSILLI_REQUIRE_OK(yBuf->read(handle, result));
for (auto val : result)
REQUIRE(val == half(129.0f));
}
12 changes: 6 additions & 6 deletions sharkfuser/tests/test_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_CASE("Buffer allocation, move semantics and lifetime", "[buffer]") {

// Read buffer and check contents.
std::vector<float> result;
REQUIRE(isOk(buf.read(handle, result)));
FUSILLI_REQUIRE_OK(buf.read(handle, result));
for (auto val : result)
REQUIRE(val == 1.0f);

Expand All @@ -51,7 +51,7 @@ TEST_CASE("Buffer allocation, move semantics and lifetime", "[buffer]") {

// Read moved buffer and check contents.
result.clear();
REQUIRE(isOk(movedBuf.read(handle, result)));
FUSILLI_REQUIRE_OK(movedBuf.read(handle, result));
for (auto val : result)
REQUIRE(val == 1.0f);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ TEST_CASE("Buffer import and lifetimes", "[buffer]") {

// Read buffer and check contents.
std::vector<half> result;
REQUIRE(isOk(buf.read(handle, result)));
FUSILLI_REQUIRE_OK(buf.read(handle, result));
for (auto val : result)
REQUIRE(val == half(1.0f));

Expand All @@ -92,7 +92,7 @@ TEST_CASE("Buffer import and lifetimes", "[buffer]") {

// Read imported buffer and check contents.
result.clear();
REQUIRE(isOk(importedBuf.read(handle, result)));
FUSILLI_REQUIRE_OK(importedBuf.read(handle, result));
for (auto val : result)
REQUIRE(val == half(1.0f));
}
Expand All @@ -102,7 +102,7 @@ TEST_CASE("Buffer import and lifetimes", "[buffer]") {

// Read original buffer and check contents.
result.clear();
REQUIRE(isOk(buf.read(handle, result)));
FUSILLI_REQUIRE_OK(buf.read(handle, result));
for (auto val : result)
REQUIRE(val == 1.0f);
}
Expand Down Expand Up @@ -138,7 +138,7 @@ TEST_CASE("Buffer errors", "[buffer]") {

// Read buffer into an empty vector should work.
result.clear();
REQUIRE(isOk(buf.read(handle, result)));
FUSILLI_REQUIRE_OK(buf.read(handle, result));
for (auto val : result)
REQUIRE(val == 0.0f);
}
Expand Down
12 changes: 6 additions & 6 deletions sharkfuser/tests/test_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST_CASE("CacheFile::create remove = true", "[CacheFile]") {
REQUIRE(std::filesystem::exists(cacheFilePath));

// Roundtrip writing and reading.
REQUIRE(isOk(cf.write("test content")));
FUSILLI_REQUIRE_OK(cf.write("test content"));
std::string content = FUSILLI_REQUIRE_UNWRAP(cf.read());
REQUIRE(content == "test content");
}
Expand All @@ -46,8 +46,8 @@ TEST_CASE("CacheFile::create remove = true", "[CacheFile]") {
/*remove=*/true));

// Write different content to each file.
REQUIRE(isOk(cf1.write("content1")));
REQUIRE(isOk(cf2.write("content2")));
FUSILLI_REQUIRE_OK(cf1.write("content1"));
FUSILLI_REQUIRE_OK(cf2.write("content2"));

// Store paths before move.
std::filesystem::path path1 = cf1.path;
Expand Down Expand Up @@ -109,8 +109,8 @@ TEST_CASE("CacheFile::create remove = false", "[CacheFile]") {
/*remove=*/false));

// Write different content to each file.
REQUIRE(isOk(cf1.write("content1")));
REQUIRE(isOk(cf2.write("content2")));
FUSILLI_REQUIRE_OK(cf1.write("content1"));
FUSILLI_REQUIRE_OK(cf2.write("content2"));

// Store paths before move.
std::filesystem::path path1 = cf1.path;
Expand Down Expand Up @@ -156,7 +156,7 @@ TEST_CASE("CacheFile::open", "[CacheFile]") {
/*graphName=*/"test_graph",
/*filename=*/"test_file.txt",
/*remove=*/true));
REQUIRE(isOk(cacheFile.write("test data")));
FUSILLI_REQUIRE_OK(cacheFile.write("test data"));

// Now open the existing file.
CacheFile opened =
Expand Down
Loading
Loading