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

Enable cross-directory ccache #1539

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions .flake/pkgs/ffdb/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib
, stdenv
, makeWrapper
, gdb
, python3
, proj
}:

stdenv.mkDerivation rec {
pname = "ffdb";
version = "0.1";

pythonPath = with python3.pkgs; makePythonPath [
proj
];

dontBuild = true;

nativeBuildInputs = [ makeWrapper ];

src = ./.;

installPhase = ''
mkdir -p $out/share/ffdb
cp ffdb.py $out/share/ffdb
makeWrapper ${gdb}/bin/gdb $out/bin/gdb \
--add-flags "-q -x $out/share/ffdb/ffdb.py" \
--set NIX_PYTHONPATH ${pythonPath} \
--prefix PATH : ${lib.makeBinPath [
python3
]}
cp $out/bin/gdb $out/bin/ffdb
'';

nativeCheckInputs = [
gdb
python3
proj
];
}
112 changes: 112 additions & 0 deletions .flake/pkgs/ffdb/ffdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
from proj.config_file import get_config_root
from pathlib import Path
import gdb

gdb.execute(f'directory {get_config_root(Path.cwd())}')
gdb.prompt_hook = lambda x: '(ffdb) '
gdb.execute('set history save on')

# python
# from proj.config_file import get_config_root
# from pathlib import Path
# print(Path.cwd())
# #gdb.execute(f'directory {get_conf}/{}')
# end

# show directories

# import gdb.printing
#
# class NodePrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# ptr = self.val["ptr"]
# if ptr != 0:
# op_type = ptr.referenced_value()['op_type']
# return f'Node<guid={self.val["guid"]} ptr={ptr} op_type={op_type}>'
# else:
# return f'Node<guid={self.val["guid"]} ptr={self.val["ptr"]}>'
#
# class EdgePrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# return f'Edge<src={self.val["srcOp"]["guid"]} dst={self.val["dstOp"]["guid"]}>'
#
# class MachineViewPrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# toks = []
# if self.val['device_type'] == 0:
# toks.append('type=GPU')
# else:
# toks.append('type=CPU')
# start_device_id = self.val['start_device_id']
# for i in range(self.val['ndims']):
# dim = self.val['dim'][i]
# stride = self.val['stride'][i]
# toks.append(f'{i}=[{start_device_id}:{start_device_id+dim}:{stride}]')
# return f'MachineView<{" ".join(toks)}>'
#
# class DomainPrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# toks = []
# ndim = self.val['dim']
# for i in range(ndim):
# lo = self.val['rect_data'][i]
# hi = self.val['rect_data'][i + ndim]
# toks.append(f'{i}=[{lo}:{hi}]')
# return f'Domain<{" ".join(toks)}>'
#
# class TensorShapePrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# toks = []
# ndim = self.val['num_dims']
# for i in range(ndim):
# dim = self.val['dims'][i]
# size = dim['size']
# degree = dim['degree']
# parallel_idx = dim['parallel_idx']
# toks.append(f'{i}=[s={size} d={degree} pi={parallel_idx}]')
# return f'TensorShape<{" ".join(toks)}>'
#
# class ParallelTensorBasePrinter:
# def __init__(self, val):
# self.val = val
#
# def to_string(self):
# toks = []
# toks.append(f'guid={self.val["parallel_tensor_guid"]}')
# ndim = self.val['num_dims']
# for i in range(ndim):
# dim = self.val['dims'][i]
# size = dim['size']
# degree = dim['degree']
# parallel_idx = dim['parallel_idx']
# toks.append(f'{i}=[s={size} d={degree} pi={parallel_idx}]')
# return f'ParallelTensorBase<{" ".join(toks)}>'
#
# def build_pretty_printer():
# pp = gdb.printing.RegexpCollectionPrettyPrinter(
# "flexflow")
# pp.add_printer('Node', '^FlexFlow::PCG::Node$', NodePrinter)
# pp.add_printer('Edge', '^FlexFlow::PCG::Edge$', EdgePrinter)
# pp.add_printer('MachineView', '^FlexFlow::MachineView$', MachineViewPrinter)
# pp.add_printer('Domain', '^Legion::Domain$', DomainPrinter)
# pp.add_printer('ParallelTensorShape', '^FlexFlow::ParallelTensorShape$', TensorShapePrinter)
# pp.add_printer('ParallelTensorBase', '^FlexFlow::ParallelTensorBase$', ParallelTensorBasePrinter)
# return pp
#
# gdb.printing.register_pretty_printer(
# gdb.current_objfile(), build_pretty_printer(), replace=True)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# gdb history
.gdb_history

# dtgen files
*.dtg.cc
*.dtg.h
Expand Down
2 changes: 1 addition & 1 deletion cmake/flexflow-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(ff_set_cxx_properties target)
CXX_EXTENSIONS NO
)
target_compile_options(${target}
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:> # add C++ compile flags here
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:> "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." # add C++ compile flags here
)
endfunction()

Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
mkShell = pkgs.mkShell.override {
stdenv = pkgs.cudaPackages.backendStdenv;
};

proj = proj-repo.packages.${system}.proj;
in
{
packages = {
legion = pkgs.callPackage ./.flake/pkgs/legion.nix { };
ffdb = pkgs.callPackage ./.flake/pkgs/ffdb { inherit proj; };
hpp2plantuml = pkgs.python3Packages.callPackage ./.flake/pkgs/hpp2plantuml.nix { };
rapidcheckFull = pkgs.symlinkJoin {
name = "rapidcheckFull";
Expand Down Expand Up @@ -102,9 +105,7 @@
doxygen
lcov # for code coverage
])
(with proj-repo.packages.${system}; [
proj
])
[ proj ]
(with self.packages.${system}; [
legion
hpp2plantuml
Expand All @@ -128,7 +129,6 @@
gh-markdown-preview
shellcheck
plantuml
gdb
ruff
compdb
jq
Expand All @@ -148,6 +148,9 @@
black
toml
])
(with self.packages.${system}; [
ffdb
])
];
};
};
Expand Down
77 changes: 0 additions & 77 deletions scripts/format.sh

This file was deleted.

Loading
Loading