Revert "Temporarily Revert "[clangd] Add Random Forest runtime for code completion.""
authorUtkarsh Saxena <usx@google.com>
Sat, 19 Sep 2020 08:07:34 +0000 (10:07 +0200)
committerUtkarsh Saxena <usx@google.com>
Sat, 19 Sep 2020 08:54:04 +0000 (10:54 +0200)
commit985deba9319be464673c1002767f8a3ec597480d
treece435d785f13151b10870043104431b7a9ff7636
parentf64903fd81764f1fde7aeb00eea5e1d488458f63
Revert "Temporarily Revert "[clangd] Add Random Forest runtime for code completion.""

We intend to replace heuristics based code completion ranking with a Decision Forest Model.

This patch introduces a format for representing the model and an inference runtime that is code-generated at build time.
- Forest.json contains all the trees as an array of trees.
- Features.json describes the features to be used.
- Codegen file takes the above two files and generates CompletionModel containing Feature struct and corresponding Evaluate function.
   The Evaluate function maps a feature to a real number describing the relevance of this candidate.
- The codegen is part of build system and these files are generated at build time.
- Proposes a way to test the generated runtime using a test model.
  - Replicates the model structure in unittests.
  - unittest tests both the test model (for correct tree traversal) and the real model (for sanity).

This reverts commit 549e55b3d5634870aa9d42135f51ad46a6a0e347.
12 files changed:
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/quality/CompletionModel.cmake [new file with mode: 0644]
clang-tools-extra/clangd/quality/CompletionModelCodegen.py [new file with mode: 0644]
clang-tools-extra/clangd/quality/README.md [new file with mode: 0644]
clang-tools-extra/clangd/quality/model/features.json [new file with mode: 0644]
clang-tools-extra/clangd/quality/model/forest.json [new file with mode: 0644]
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/clangd/unittests/DecisionForestTests.cpp [new file with mode: 0644]
clang-tools-extra/clangd/unittests/decision_forest_model/CategoricalFeature.h [new file with mode: 0644]
clang-tools-extra/clangd/unittests/decision_forest_model/features.json [new file with mode: 0644]
clang-tools-extra/clangd/unittests/decision_forest_model/forest.json [new file with mode: 0644]