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

Remove dead code #11

Closed
wants to merge 6 commits into from
Closed
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
4 changes: 0 additions & 4 deletions tensorflow_quantum/core/qsim/statespace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ void StateSpace::DeleteState(State* state) {
qsim::_aligned_free(state->release());
}

State StateSpace::NullState() { return State(nullptr, &free); }

uint64_t StateSpace::Size() const { return size_ / 2; }

uint64_t StateSpace::RawSize() const { return size_; }

float* StateSpace::RawData(State* state) { return state->get(); }

const float* StateSpace::RawData(const State& state) { return state.get(); }
Expand Down
5 changes: 0 additions & 5 deletions tensorflow_quantum/core/qsim/statespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@ class StateSpace {

static void DeleteState(State* state);

static State NullState();

uint64_t Size() const;

uint64_t RawSize() const;

static float* RawData(State* state);
static const float* RawData(const State& state);

static bool Valid(const State& state);

virtual void CopyState(const State& src, State* dest) const = 0;
virtual void SetStateUniform(State* state) const = 0;
virtual void SetStateZero(State* state) const = 0;
virtual float GetRealInnerProduct(const State& a, const State& b) const = 0;
virtual std::complex<float> GetAmpl(const State& state,
Expand Down
16 changes: 0 additions & 16 deletions tensorflow_quantum/core/qsim/statespace_avx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ void StateSpaceAVX::CopyState(const State& src, State* dest) const {
}
}

void StateSpaceAVX::SetStateUniform(State* state) const {
uint64_t size = size_ / 2;

__m256 valu = _mm256_set1_ps(1.0f / std::sqrt(size));
__m256 val0 = _mm256_setzero_ps();

uint64_t size2 = size / 8;

auto data = state->get();

for (uint64_t i = 0; i < size2; ++i) {
_mm256_store_ps(data + 16 * i, valu);
_mm256_store_ps(data + 16 * i + 8, val0);
}
}

void StateSpaceAVX::SetStateZero(State* state) const {
uint64_t size2 = (size_ / 2) / 8;

Expand Down
2 changes: 0 additions & 2 deletions tensorflow_quantum/core/qsim/statespace_avx.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class StateSpaceAVX : public StateSpace {

void CopyState(const State& src, State* dest) const override;

void SetStateUniform(State* state) const override;

void SetStateZero(State* state) const override;

float GetRealInnerProduct(const State& a, const State& b) const override;
Expand Down
12 changes: 0 additions & 12 deletions tensorflow_quantum/core/qsim/statespace_slow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ void StateSpaceSlow::CopyState(const State& src, State* dest) const {
}
}

void StateSpaceSlow::SetStateUniform(State* state) const {
uint64_t size = size_ / 2;
auto data = RawData(state);
float norm = 1.0 / std::sqrt(size);

//#pragma omp parallel for num_threads(num_threads_)
for (uint64_t i = 0; i < size; ++i) {
data[2 * i + 0] = norm;
data[2 * i + 1] = 0;
}
}

void StateSpaceSlow::SetStateZero(State* state) const {
uint64_t size = size_ / 2;

Expand Down
2 changes: 0 additions & 2 deletions tensorflow_quantum/core/qsim/statespace_slow.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class StateSpaceSlow : public StateSpace {

void CopyState(const State& src, State* dest) const override;

void SetStateUniform(State* state) const override;

void SetStateZero(State* state) const override;

float GetRealInnerProduct(const State& a, const State& b) const override;
Expand Down
21 changes: 0 additions & 21 deletions tensorflow_quantum/core/qsim/statespace_sse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,6 @@ void StateSpaceSSE::CopyState(const State& src, State* dest) const {
}
}

void StateSpaceSSE::SetStateUniform(State* state) const {
uint64_t size = size_ / 2;

__m128 valu = _mm_set1_ps(1.0f / std::sqrt(size));
__m128 val0 = _mm_setzero_ps();

uint64_t size2 = size / 8;

auto data = state->get();

//#pragma omp parallel for num_threads(num_threads_)
for (uint64_t i = 0; i < size2; ++i) {
//_mm256_store_ps(state.get() + 16 * i, valu);
_mm_store_ps(data + 16 * i, valu);
_mm_store_ps(data + 16 * i + 4, valu);
//_mm256_store_ps(state.get() + 16 * i + 8, val0);
_mm_store_ps(data + 16 * i + 8, val0);
_mm_store_ps(data + 16 * i + 12, val0);
}
}

void StateSpaceSSE::SetStateZero(State* state) const {
uint64_t size2 = (size_ / 2) / 8;

Expand Down
2 changes: 0 additions & 2 deletions tensorflow_quantum/core/qsim/statespace_sse.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class StateSpaceSSE : public StateSpace {

void CopyState(const State& src, State* dest) const override;

void SetStateUniform(State* state) const override;

void SetStateZero(State* state) const override;

float GetRealInnerProduct(const State& a, const State& b) const override;
Expand Down