Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [LAS] remove compile time flag and its own custom CI #4249

Merged
merged 15 commits into from
Oct 26, 2022
30 changes: 0 additions & 30 deletions .github/workflows/build_vw_large_action_space.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ option(SPDLOG_SYS_DEP "Override using the submodule for spdlog dependency. Inste
option(VW_BOOST_MATH_SYS_DEP "Override using the submodule for boost math dependency. Instead will use find_package" OFF)
option(VW_ZLIB_SYS_DEP "Override using the submodule for zlib dependency. Instead will use find_package" ON)
option(VW_GTEST_SYS_DEP "Override using fetch package for gtest dependency. Instead will use find_package" OFF)
option(VW_EIGEN_SYS_DEP "Override using the submodule for Eigen3 dependency. Instead will use find_package" OFF)
option(VW_BUILD_VW_C_WRAPPER "Enable building the c_wrapper project" ON)
option(VW_BUILD_CSV "Build csv parser" OFF)
option(VW_BUILD_LARGE_ACTION_SPACE "Enable large action space reduction" OFF)
option(vw_BUILD_NET_CORE "Build .NET Core targets" OFF)
option(vw_BUILD_NET_FRAMEWORK "Build .NET Framework targets" OFF)
option(VW_USE_ASAN "Compile with AddressSanitizer" OFF)
Expand Down
4 changes: 4 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"VW_GTEST_SYS_DEP": {
"type": "BOOL",
"value": "ON"
},
"VW_EIGEN_SYS_DEP": {
"type": "BOOL",
"value": "ON"
}
}
},
Expand Down
12 changes: 7 additions & 5 deletions ext_libs/ext_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ if(BUILD_FLATBUFFERS)
include(FlatbufferUtils)
endif()

if(VW_BUILD_LARGE_ACTION_SPACE)
if(VW_EIGEN_SYS_DEP)
# Since EXACT is not specified, any version compatible with 3.4.0 is accepted (>= 3.4.0)
find_package(Eigen3 3.4.0 CONFIG REQUIRED)
add_library(eigen INTERFACE)
target_include_directories(eigen SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/eigen>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(eigen INTERFACE ${EIGEN3_INCLUDE_DIR})
else()
add_library(eigen INTERFACE)
target_include_directories(eigen SYSTEM INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/eigen>)
olgavrou marked this conversation as resolved.
Show resolved Hide resolved
endif()
149 changes: 0 additions & 149 deletions test/benchmarks/standalone/benchmark_text_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_same_char_interactions, gen_ccb_examp
"--ccb_explore_adf --quiet -q ::")
->MinTime(15.0);

#ifdef BUILD_LARGE_ACTION_SPACE
BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_small_300_onestep,
gen_cb_examples(1, 50, 10, 300, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
Expand Down Expand Up @@ -320,151 +319,3 @@ BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_small_500_plaincb,
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

Copy link
Collaborator

Choose a reason for hiding this comment

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

why removed these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because the benchmarks CI will run forever if we keep these and we don't really need all of them to catch perf drops

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_small_1k_onestep,
gen_cb_examples(1, 50, 10, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_small_1k_onestep_max_threads,
gen_cb_examples(1, 50, 10, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_small_1k_plaincb,
gen_cb_examples(1, 50, 10, 1000, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_300_onestep,
gen_cb_examples(1, 50, 20, 300, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_300_onestep_max_threads,
gen_cb_examples(1, 50, 20, 300, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_300_plaincb,
gen_cb_examples(1, 50, 20, 300, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_500_onestep,
gen_cb_examples(1, 50, 20, 500, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_500_onestep_max_threads,
gen_cb_examples(1, 50, 20, 500, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_500_plaincb,
gen_cb_examples(1, 50, 20, 500, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_1k_onestep,
gen_cb_examples(1, 50, 20, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_1k_onestep_max_threads,
gen_cb_examples(1, 50, 20, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_medium_1k_plaincb,
gen_cb_examples(1, 50, 20, 1000, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_300_onestep,
gen_cb_examples(1, 50, 50, 300, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_300_onestep_max_threads,
gen_cb_examples(1, 50, 50, 300, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_300_plaincb,
gen_cb_examples(1, 50, 50, 300, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_500_onestep,
gen_cb_examples(1, 50, 50, 500, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_500_onestep_max_threads,
gen_cb_examples(1, 50, 50, 500, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_500_plaincb,
gen_cb_examples(1, 50, 50, 500, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_1k_onestep,
gen_cb_examples(1, 50, 50, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_1k_onestep_max_threads,
gen_cb_examples(1, 50, 50, 1000, 5, 5, 20, 10, false),
"--cb_explore_adf --large_action_space -q :: --max_actions 20 --quiet --thread_pool_size " +
std::to_string(std::thread::hardware_concurrency()))
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);

BENCHMARK_CAPTURE(benchmark_multi_predict, cb_las_large_1k_plaincb,
gen_cb_examples(1, 50, 50, 1000, 5, 5, 20, 10, false), "--cb_explore_adf -q :: --quiet")
->MinTime(15.0)
->UseRealTime()
->Unit(benchmark::kMillisecond);
#endif
21 changes: 21 additions & 0 deletions test/train-sets/ref/help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,27 @@ Weight Options:
uint, keep, necessary)
--replay_m_count arg How many times (in expectation) should each example be played
(default: 1 = permuting) (type: uint, default: 1)
[Reduction] Experimental: Contextual Bandit Exploration with ADF with large action space filtering Options:
--cb_explore_adf Online explore-exploit for a contextual bandit problem with multiline
action dependent features (type: bool, keep, necessary)
--large_action_space Large action space filtering (type: bool, keep, necessary, experimental)
--max_actions arg Max number of actions to hold (type: uint, default: 20, keep,
experimental)
--spanner_c arg Parameter for computing c-approximate spanner (type: float, default:
2, keep, experimental)
--full_predictions Full representation of the prediction's action probabilities,
if not specified filtered out actions will not appear in the
final predictions. If specified, filtered out actions will appear
with a probability of zero (type: bool, experimental)
--thread_pool_size arg Number of threads in the thread pool that will be used when running
with one pass svd implementation (default svd implementation
option). Default thread pool size will be half of the available
hardware threads (type: uint)
--block_size arg Number of actions in a block to be scheduled for multithreading
when using one pass svd implementation (by default, block_size
= num_actions / thread_pool_size) (type: uint, default: 0)
--two_pass_svd A more accurate svd that is much slower than the default (one
pass svd) (type: bool, experimental)
[Reduction] Explore Evaluation Options:
--explore_eval Evaluate explore_eval adf policies (type: bool, keep, necessary)
--multiplier arg Multiplier used to make all rejection sample probabilities <=
Expand Down
7 changes: 3 additions & 4 deletions test/unit_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ add_executable(vw-unit-test.out
cats_tree_test.cc
cats_user_provided_pdf.cc
cb_explore_adf_test.cc
cb_large_actions_test.cc
cb_las_one_pass_svd_test.cc
cb_las_spanner_test.cc
ccb_parser_test.cc
ccb_test.cc
chain_hashing.cc
Expand Down Expand Up @@ -59,10 +62,6 @@ add_executable(vw-unit-test.out
weights_test.cc
)

if(VW_BUILD_LARGE_ACTION_SPACE)
target_sources(vw-unit-test.out PRIVATE cb_large_actions_test.cc cb_las_one_pass_svd_test.cc cb_las_spanner_test.cc)
endif()

# Add the include directories from vw target for testing
target_link_libraries(vw-unit-test.out PRIVATE vw_core Boost::unit_test_framework)
target_include_directories(vw-unit-test.out PRIVATE $<TARGET_PROPERTY:vw_core,INCLUDE_DIRECTORIES>)
Expand Down
2 changes: 1 addition & 1 deletion test/unit_test/cb_las_spanner_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static std::vector<std::string> gen_cb_examples(

action_ss << "| ";
for (int action_feat = 0; action_feat < coordinates; ++action_feat)
{ action_ss << "x" << action_feat << ":" << (drand48() * scale) << " "; }
{ action_ss << "x" << action_feat << ":" << ((static_cast<double>(std::rand()) / RAND_MAX) * scale) << " "; }

examples.push_back(action_ss.str());
}
Expand Down
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "9.5.0",
"dependencies": [
"boost-math",
"eigen3",
"flatbuffers",
"fmt",
"rapidjson",
Expand Down
32 changes: 10 additions & 22 deletions vowpalwabbit/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ set(vw_core_headers
include/vw/core/prediction_type.h
include/vw/core/print_utils.h
include/vw/core/prob_dist_cont.h
include/vw/core/qr_decomposition.h
include/vw/core/queue.h
include/vw/core/rand_state.h
include/vw/core/rand48.h
Expand All @@ -94,6 +95,7 @@ set(vw_core_headers
include/vw/core/reductions/cats_pdf.h
include/vw/core/reductions/cats_tree.h
include/vw/core/reductions/cats.h
include/vw/core/reductions/cb/cb_actions_mask.h
include/vw/core/reductions/cb/cb_adf.h
include/vw/core/reductions/cb/cb_algs.h
include/vw/core/reductions/cb/cb_dro.h
Expand All @@ -102,6 +104,7 @@ set(vw_core_headers
include/vw/core/reductions/cb/cb_explore_adf_cover.h
include/vw/core/reductions/cb/cb_explore_adf_first.h
include/vw/core/reductions/cb/cb_explore_adf_greedy.h
include/vw/core/reductions/cb/cb_explore_adf_large_action_space.h
include/vw/core/reductions/cb/cb_explore_adf_regcb.h
include/vw/core/reductions/cb/cb_explore_adf_rnd.h
include/vw/core/reductions/cb/cb_explore_adf_softmax.h
Expand Down Expand Up @@ -239,6 +242,7 @@ set(vw_core_sources
src/prediction_type.cc
src/print_utils.cc
src/prob_dist_cont.cc
src/qr_decomposition.cc
src/rand48.cc
src/reduction_stack.cc
src/reductions/active_cover.cc
Expand All @@ -255,13 +259,18 @@ set(vw_core_sources
src/reductions/cats_pdf.cc
src/reductions/cats_tree.cc
src/reductions/cats.cc
src/reductions/cb/details/large_action/one_pass_svd_impl.cc
src/reductions/cb/details/large_action/one_rank_spanner_impl.cc
src/reductions/cb/details/large_action/two_pass_svd_impl.cc
src/reductions/cb/cb_actions_mask.cc
src/reductions/cb/cb_adf.cc
src/reductions/cb/cb_algs.cc
src/reductions/cb/cb_dro.cc
src/reductions/cb/cb_explore_adf_bag.cc
src/reductions/cb/cb_explore_adf_cover.cc
src/reductions/cb/cb_explore_adf_first.cc
src/reductions/cb/cb_explore_adf_greedy.cc
src/reductions/cb/cb_explore_adf_large_action_space.cc
src/reductions/cb/cb_explore_adf_regcb.cc
src/reductions/cb/cb_explore_adf_rnd.cc
src/reductions/cb/cb_explore_adf_softmax.cc
Expand Down Expand Up @@ -343,23 +352,6 @@ set(vw_core_sources
src/vw_validate.cc
)

if(VW_BUILD_LARGE_ACTION_SPACE)
set(vw_core_headers
${vw_core_headers}
include/vw/core/reductions/cb/cb_explore_adf_large_action_space.h
include/vw/core/reductions/cb/cb_actions_mask.h include/vw/core/qr_decomposition.h
)

set(vw_core_sources
${vw_core_sources}
src/reductions/cb/cb_explore_adf_large_action_space.cc
src/reductions/cb/details/large_action/one_pass_svd_impl.cc
src/reductions/cb/details/large_action/two_pass_svd_impl.cc
src/reductions/cb/details/large_action/one_rank_spanner_impl.cc
src/reductions/cb/cb_actions_mask.cc src/qr_decomposition.cc
)
endif()

vw_add_library(
NAME "core"
TYPE "STATIC_ONLY"
Expand All @@ -370,6 +362,7 @@ vw_add_library(
# Use BUILD_INTERFACE to prevent them from being exported, i.e. treat them as PRIVATE
# https://gitlab.kitware.com/cmake/cmake/issues/15415
${CMAKE_DL_LIBS} ${LINK_THREADS} vw_io $<BUILD_INTERFACE:${boost_math_target}> $<BUILD_INTERFACE:RapidJSON>
$<BUILD_INTERFACE:eigen>
DESCRIPTION "This contains all remaining VW code, all reduction implementations, driver, option handling"
EXCEPTION_DESCRIPTION "Yes"
ENABLE_INSTALL
Expand All @@ -387,11 +380,6 @@ if(BUILD_FLATBUFFERS)
target_compile_definitions(vw_core PUBLIC BUILD_FLATBUFFERS)
endif()

if(VW_BUILD_LARGE_ACTION_SPACE)
target_link_libraries(vw_core PUBLIC $<BUILD_INTERFACE:eigen>)
target_compile_definitions(vw_core PUBLIC BUILD_LARGE_ACTION_SPACE)
endif()

# Handle generated header
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/vw/core/config.h)
target_include_directories(vw_core PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/>)
Expand Down
Loading