Specific API symbol recommendation layer. Five new headers: - LibrarySymbolRecord: functionName/signature/usagePattern/caveats - LibrarySymbolCatalog: multi-symbol registry per (library, domain) - LSPSymbolExtractor: parses LSP JSON into LibrarySymbolRecords - LibrarySymbolAdvisor: ranked symbols for (library, domain) alphabetically - Sprint288IntegrationSummary: CUDA+nlohmann catalog; cublasSgemm+json::parse verified 25/25 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
3.0 KiB
C++
83 lines
3.0 KiB
C++
// Step 1972: Sprint 288 Integration
|
|
//
|
|
// t1: buildSeedCatalog has cublas and nlohmann entries
|
|
// t2: cublasSgemm found for (cublas, compute.matrix)
|
|
// t3: json::parse found for (nlohmann_json, serialization.json)
|
|
// t4: verifyCUDALookup and verifyNlohmannLookup both pass
|
|
// t5: Sprint288IntegrationSummary metadata correct
|
|
|
|
#include "Sprint288IntegrationSummary.h"
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
|
|
namespace ws = whetstone;
|
|
static int p = 0, f = 0;
|
|
#define T(n) { std::cout << " " << #n << "... "; }
|
|
#define P() { std::cout << "PASS\n"; ++p; }
|
|
#define F(m) { std::cout << "FAIL: " << m << "\n"; ++f; }
|
|
#define C(c, m) if (!(c)) { F(m); return; }
|
|
|
|
void t1() {
|
|
T(seed_catalog_has_cublas_and_nlohmann);
|
|
auto cat = ws::Sprint288IntegrationSummary::buildSeedCatalog();
|
|
C(cat.has("cublas", "compute.matrix"), "cublas/compute.matrix");
|
|
C(cat.has("nlohmann_json", "serialization.json"), "nlohmann_json/serialization.json");
|
|
C(cat.size() == 4, "4 total records, got " + std::to_string(cat.size()));
|
|
P();
|
|
}
|
|
|
|
void t2() {
|
|
T(cublasSgemm_found_for_cublas_compute_matrix);
|
|
auto cat = ws::Sprint288IntegrationSummary::buildSeedCatalog();
|
|
ws::LibrarySymbolAdvisor adv;
|
|
auto syms = adv.advise("cublas", "compute.matrix", cat);
|
|
C(syms.size() == 2, "2 cublas/compute.matrix symbols");
|
|
bool hasSgemm = false;
|
|
for (const auto& s : syms) if (s.functionName == "cublasSgemm") hasSgemm = true;
|
|
C(hasSgemm, "cublasSgemm present");
|
|
// Verify signature mentions handle
|
|
for (const auto& s : syms) {
|
|
if (s.functionName == "cublasSgemm") {
|
|
C(s.signature.find("cublasHandle_t") != std::string::npos, "signature has handle");
|
|
C(!s.caveats.empty(), "cublasSgemm has caveats");
|
|
}
|
|
}
|
|
P();
|
|
}
|
|
|
|
void t3() {
|
|
T(json_parse_found_for_nlohmann_serialization_json);
|
|
auto cat = ws::Sprint288IntegrationSummary::buildSeedCatalog();
|
|
ws::LibrarySymbolAdvisor adv;
|
|
auto syms = adv.advise("nlohmann_json", "serialization.json", cat);
|
|
C(syms.size() == 2, "2 nlohmann/serialization.json symbols");
|
|
bool hasParse = false;
|
|
for (const auto& s : syms) if (s.functionName == "json::parse") hasParse = true;
|
|
C(hasParse, "json::parse present");
|
|
P();
|
|
}
|
|
|
|
void t4() {
|
|
T(verify_CUDA_and_nlohmann_lookups_pass);
|
|
auto cat = ws::Sprint288IntegrationSummary::buildSeedCatalog();
|
|
C(ws::Sprint288IntegrationSummary::verifyCUDALookup(cat), "verifyCUDALookup");
|
|
C(ws::Sprint288IntegrationSummary::verifyNlohmannLookup(cat), "verifyNlohmannLookup");
|
|
P();
|
|
}
|
|
|
|
void t5() {
|
|
T(sprint288_metadata);
|
|
ws::Sprint288IntegrationSummary s;
|
|
C(s.stepsCompleted == 5, "5 steps");
|
|
C(s.success, "success");
|
|
C(s.sprintName() == "Sprint 288: LibrarySymbolAdvisor", "name");
|
|
P();
|
|
}
|
|
|
|
int main() {
|
|
std::cout << "Step 1972: Sprint 288 Integration\n";
|
|
t1(); t2(); t3(); t4(); t5();
|
|
std::cout << "\n" << p << "/" << (p + f) << " passed\n";
|
|
return f > 0 ? 1 : 0;
|
|
}
|